"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvironmentEntity = exports.Environments = void 0;
exports.makeEnvironmentEntity = makeEnvironmentEntity;
const core_1 = require("@vived/core");
var Environments;
(function (Environments) {
    Environments["FOREST"] = "Forest";
    Environments["NIGHT"] = "Night";
    Environments["PARKING"] = "Parking";
    Environments["ROOM"] = "Room";
    Environments["STUDIO"] = "Studio";
})(Environments || (exports.Environments = Environments = {}));
class EnvironmentEntity extends core_1.AppObjectEntity {
}
exports.EnvironmentEntity = EnvironmentEntity;
EnvironmentEntity.type = "EnvironmentEntity";
EnvironmentEntity.get = (appObjects) => (0, core_1.getSingletonComponent)(EnvironmentEntity.type, appObjects);
function makeEnvironmentEntity(appObject) {
    return new EnvironmentEntityImp(appObject);
}
class EnvironmentEntityImp extends EnvironmentEntity {
    get intensity() {
        return this.rangedIntensity.val;
    }
    set intensity(val) {
        this.rangedIntensity.val = val;
    }
    get currentEnvironment() {
        return this._memoizedCurEnv.val;
    }
    set currentEnvironment(curEnv) {
        this._memoizedCurEnv.val = curEnv;
    }
    constructor(appObject) {
        super(appObject, EnvironmentEntity.type);
        this.rangedIntensity = new core_1.RangedNumber({
            initialValue: 0.75,
            max: 1.5,
            min: 0.5,
        }, this.notifyOnChange);
        this._defaultEnv = Environments.STUDIO;
        this._memoizedCurEnv = new core_1.MemoizedString(Environments.STUDIO, this.notifyOnChange);
        this.setToDefault = () => {
            if (this._memoizedCurEnv.val !== this._defaultEnv) {
                this._memoizedCurEnv.val = this._defaultEnv;
                this.notifyOnChange();
            }
        };
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=Environment.js.map