"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlbModelRepo = void 0;
exports.makeGlbModelRepo = makeGlbModelRepo;
const core_1 = require("@vived/core");
const GlbModelEntity_1 = require("./GlbModelEntity");
class GlbModelRepo extends core_1.AppObjectEntityRepo {
    static get(appObjects) {
        return (0, core_1.getSingletonComponent)(GlbModelRepo.type, appObjects);
    }
}
exports.GlbModelRepo = GlbModelRepo;
GlbModelRepo.type = "GlbModelRepo";
function makeGlbModelRepo(appObject) {
    return new GlbModelRepoImp(appObject);
}
class GlbModelRepoImp extends GlbModelRepo {
    constructor(appObject) {
        super(appObject, GlbModelRepo.type);
        this.glbModelFactory = (id) => {
            const ao = this.appObjects.getOrCreate(id);
            return (0, GlbModelEntity_1.makeGlbModelEntity)(ao);
        };
        this.createGlbModel = (id) => {
            const idToUse = id ?? (0, core_1.generateUniqueID)();
            const object = this.glbModelFactory(idToUse);
            this.add(object);
            return object;
        };
    }
}
//# sourceMappingURL=GblModelRepo.js.map