"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ThemeColorMapPM = void 0;
const core_1 = require("@vived/core");
const ThemeColors_1 = require("../Entities/ThemeColors");
class ThemeColorMapPM extends core_1.AppObjectPM {
    vmsAreEqual(a, b) {
        return false;
    }
    constructor(appObject) {
        super(appObject, ThemeColorMapPM.type);
        this.onThemeColorMapChange = () => {
            const colorMap = new Map();
            for (const themeColor in ThemeColors_1.ThemeColorType) {
                if (!this.themeColors)
                    return;
                const castType = themeColor;
                colorMap.set(castType, this.themeColors.getColorForType(castType));
            }
            this.doUpdateView(colorMap);
        };
        this.dispose = () => {
            super.dispose();
            this.themeColors?.removeChangeObserver(this.onThemeColorMapChange);
        };
        this.themeColors = ThemeColors_1.ThemeColors.get(appObject.appObjectRepo);
        if (!this.themeColors) {
            this.warn("ThemeColorMapPM is being added to an object that does not have a ThemeColors Entity");
            return;
        }
        else {
            this.themeColors.addChangeObserver(this.onThemeColorMapChange);
            this.onThemeColorMapChange();
        }
    }
}
exports.ThemeColorMapPM = ThemeColorMapPM;
ThemeColorMapPM.type = "ThemeColorMapPM";
//# sourceMappingURL=ThemeColorMapPM.js.map