"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnablementEntity = void 0;
exports.makeEnablementEntity = makeEnablementEntity;
const core_1 = require("@vived/core");
class EnablementEntity extends core_1.AppObjectEntity {
    static addIfMissing(appObj) {
        const existing = appObj.getComponent(this.type);
        if (existing) {
            return existing;
        }
        else {
            return makeEnablementEntity(appObj);
        }
    }
    static get(appObj) {
        return appObj.getComponent(this.type);
    }
}
exports.EnablementEntity = EnablementEntity;
EnablementEntity.type = "EnablementEntity";
function makeEnablementEntity(appObject) {
    return new EnablementEntityImp(appObject);
}
class EnablementEntityImp extends EnablementEntity {
    get enabled() {
        return this.memoizedEnabled.val;
    }
    set enabled(enabled) {
        this.memoizedEnabled.val = enabled;
    }
    constructor(appObject) {
        super(appObject, EnablementEntity.type);
        this.memoizedEnabled = new core_1.MemoizedBoolean(true, this.notifyOnChange);
    }
}
//# sourceMappingURL=EnablementEntity.js.map