class TextComponent {
    render(container, component, width, height, configs) {
        this.container = container;
        this.component = component;

        this.container.style.display = "flex";
        this.container.style.flexDirection = "column";

        for (const config of configs) {
            this.updateConfig(config);
        }
    }

    resize(width, height) {
    }

    updateConfig(config) {
        switch (config.k) {
            case "text.content":
                this.container.innerText = config.v;
                break;

            case "text.style.fontColor":
                this.container.style.color = config.v;
                break;
            case "text.style.fontSize":
                this.container.style.fontSize = config.v + "px";
                break;
            case "text.style.fontFamily":
                this.container.style.fontFamily = config.v;
                break;
            case "text.style.fontBold":
                this.container.style.fontWeight = config.v === "1" ? "bold" : "normal";
                break;
            case "text.style.fontUnderline":
                this.container.style.textDecoration = config.v === "1" ? "underline" : "none";
                break;

            case "text.align.horAlign":
                this.container.style.textAlign = config.v;
                break;
            case "text.align.verAlign":
                this.container.style.justifyContent = config.v;
                break;

            case "frame.cornerRadius":
                this.container.style.borderRadius = config.v + "px";
                break;
            case "frame.fill":
                this.container.style.background = config.v;
                break;
            case "frame.borderWidth":
                this.container.style.borderWidth = config.v + "px";
                break;
            case "frame.borderColor":
                this.container.style.borderColor = config.v;
                break;
            case "frame.borderStyle":
                this.container.style.borderStyle = config.v;
                break;
        }
    }
}