import "../apps/Jobs/Jobs.js"
import "../apps/Messages.js"
import "../apps/Market/Market.js"

class AppWindow extends Shadow {
    app;

    constructor(app) {
        super()
        this.app = app
    }

    render() {
        ZStack(() => {
            switch(this.app) {
                case "Jobs":
                    Jobs()
                    break;
                case "Messages":
                    Messages()
                    break;
                case "Market":
                    Market()
                    break;
            }
        })
        .display(this.app ? '' : 'none')
        .width(100, "vw")
        .height(100, "vh")
        .backgroundColor("var(--main)")
        .position("fixed")
        .top(0)
        .left(0)
    }

    open(app) {
        this.app = app
        this.rerender()
    }

    close() {
        this.style.display = "none"
    }

}

register(AppWindow, "app-window")