import { AppObjectPM, getSingletonComponent, } from "@vived/core";
import { LabelDropRepo } from "../Entities/LabelDropRepo";
export class LabelDropEditingIDPM extends AppObjectPM {
}
LabelDropEditingIDPM.type = "LabelDropEditingIDPM";
LabelDropEditingIDPM.get = (appObjects) => getSingletonComponent(LabelDropEditingIDPM.type, appObjects);
export function makeLabelDropEditingIDPM(appObject) {
    return new LabelDropEditingIDPMImp(appObject);
}
class LabelDropEditingIDPMImp extends LabelDropEditingIDPM {
    get labelDropRepo() {
        return this.getCachedSingleton(LabelDropRepo.type);
    }
    vmsAreEqual(a, b) {
        if (a.editingId !== b.editingId)
            return false;
        if (a.isEditingNewAnswer !== b.isEditingNewAnswer)
            return false;
        return true;
    }
    constructor(appObject) {
        super(appObject, LabelDropEditingIDPM.type);
        this.onEntityChange = () => {
            if (!this.labelDropRepo)
                return;
            const vm = {
                editingId: this.labelDropRepo.editingID,
                isEditingNewAnswer: this.labelDropRepo.isEditingNewAnswer,
            };
            this.doUpdateView(vm);
        };
        this.labelDropRepo?.addChangeObserver(this.onEntityChange);
        this.appObjects.registerSingleton(this);
        this.onEntityChange();
    }
}
export const defaultLabelDropEditingIDVM = {
    editingId: undefined,
    isEditingNewAnswer: false,
};
//# sourceMappingURL=LabelDropEditingIDPM.js.map