import { AppObjectUC, cubicInOut, getSingletonComponent, Vector3, } from "@vived/core";
import { SceneRootEntity } from "../../SceneRoot";
import { StoredView } from "../Entities";
export class RestoreStoredViewUC extends AppObjectUC {
}
RestoreStoredViewUC.type = "RestoreStoredViewUC";
RestoreStoredViewUC.get = (appObjects) => getSingletonComponent(RestoreStoredViewUC.type, appObjects);
export function makeRestoreStoredViewUC(appObject) {
    return new RestoreStoredViewUCImp(appObject);
}
class RestoreStoredViewUCImp extends RestoreStoredViewUC {
    get storedView() {
        return this.getCachedSingleton(StoredView.type);
    }
    get sceneRoot() {
        return this.getCachedSingleton(SceneRootEntity.type);
    }
    constructor(appObject) {
        super(appObject, RestoreStoredViewUC.type);
        this.ease = cubicInOut;
        this.restoreStoredView = () => {
            if (this.storedView && this.sceneRoot) {
                if (!this.storedView.hasStoredView)
                    return;
                const scale = new Vector3(this.storedView.scale, this.storedView.scale, this.storedView.scale);
                const lerpDTO = {
                    durationMS: 1000,
                    ease: this.ease,
                    desiredPosition: this.storedView.position,
                    desiredRotation: this.storedView.rotation,
                    desiredScale: scale,
                };
                this.sceneRoot.transform.lerp(lerpDTO);
            }
            else {
                this.warn("Missing necessary entities");
            }
        };
    }
}
//# sourceMappingURL=RestoreStoredViewUC.js.map