import { AppObjectEntity, MemoizedBoolean } from "@vived/core";
export class EnablementEntity extends 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);
    }
}
EnablementEntity.type = "EnablementEntity";
export 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 MemoizedBoolean(true, this.notifyOnChange);
    }
}
//# sourceMappingURL=EnablementEntity.js.map