package dev.bytevibe.hyperpoint;

import javafx.scene.paint.Color;

/**
 * 主题管理器，管理应用的颜色和样式主题
 */
public class Theme {
    // 主题名称
    private String name;

    // 背景颜色
    private Color backgroundColor;

    // 菜单栏颜色
    private Color menuBarColor;

    // 菜单栏文字颜色
    private Color menuTextColor;

    // 页面背景颜色
    private Color pageBackgroundColor;

    // 边框颜色
    private Color borderColor;

    // 主色调（用于按钮、选中状态等）
    private Color primaryColor;

    // 次色调
    private Color secondaryColor;

    public Theme(String name, Color backgroundColor, Color menuBarColor, Color menuTextColor,
                 Color pageBackgroundColor, Color borderColor, Color primaryColor, Color secondaryColor) {
        this.name = name;
        this.backgroundColor = backgroundColor;
        this.menuBarColor = menuBarColor;
        this.menuTextColor = menuTextColor;
        this.pageBackgroundColor = pageBackgroundColor;
        this.borderColor = borderColor;
        this.primaryColor = primaryColor;
        this.secondaryColor = secondaryColor;
    }

    // Getters and Setters
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public Color getBackgroundColor() { return backgroundColor; }
    public void setBackgroundColor(Color backgroundColor) { this.backgroundColor = backgroundColor; }

    public Color getMenuBarColor() { return menuBarColor; }
    public void setMenuBarColor(Color menuBarColor) { this.menuBarColor = menuBarColor; }

    public Color getMenuTextColor() { return menuTextColor; }
    public void setMenuTextColor(Color menuTextColor) { this.menuTextColor = menuTextColor; }

    public Color getPageBackgroundColor() { return pageBackgroundColor; }
    public void setPageBackgroundColor(Color pageBackgroundColor) { this.pageBackgroundColor = pageBackgroundColor; }

    public Color getBorderColor() { return borderColor; }
    public void setBorderColor(Color borderColor) { this.borderColor = borderColor; }

    public Color getPrimaryColor() { return primaryColor; }
    public void setPrimaryColor(Color primaryColor) { this.primaryColor = primaryColor; }

    public Color getSecondaryColor() { return secondaryColor; }
    public void setSecondaryColor(Color secondaryColor) { this.secondaryColor = secondaryColor; }

    /**
     * 转换颜色为十六进制字符串
     */
    public static String colorToHex(Color color) {
        return String.format("#%02X%02X%02X",
                (int) (color.getRed() * 255),
                (int) (color.getGreen() * 255),
                (int) (color.getBlue() * 255));
    }
}

