/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
<% if (internal) {%>import {
  kosDependency,
  kosModel,
  kosContainerAware,
  kosTopicHandler,
  type KosContainerAware,
  kosLoggerAware, 
  type KosLoggerAware,
} from "../../../core/core/decorators";
import type {
  IKosDataModel
} from "../../../core/core/kosModel";
import type { KosModelRegistrationType } from "../../../core/core/registration/model-registration";
import type { IKosIdentifiable } from "../../../core/core/types";
import type { PublicModelInterface } from "../../../core/types";
<% } else { %>import { kosModel, kosContainerAware, type KosContainerAware } from "@kosdev-code/kos-ui-sdk";
import  {   type KosModelRegistrationType, IKosDataModel, IKosIdentifiable, PublicModelInterface, kosLoggerAware, type KosLoggerAware } from "@kosdev-code/kos-ui-sdk";<% } %>


import type { <%= nameProperCase %>Options } from "./types";
import type { <%= modelNameProperCase %>Model } from  "./<%= modelNameDashCase %>-model";


export const MODEL_TYPE = "<%= nameDashCase %>-model";

export type <%= nameProperCase %>Model = PublicModelInterface<<%= nameProperCase %>ModelImpl>;

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface <%= nameProperCase %>ModelImpl extends KosLoggerAware, KosContainerAware<<%= modelNameProperCase %>Model> {}

@kosModel({ modelTypeId: MODEL_TYPE, singleton: true<% if (autoRegister) { %>, autoRegister: true<% } %> })
@kosContainerAware<<%= modelNameProperCase %>Model>()
@kosLoggerAware()
export class <%= nameProperCase %>ModelImpl implements IKosIdentifiable, IKosDataModel {

    // Registration property for type safety - actual value injected by @kosModel decorator
    static Registration: KosModelRegistrationType<<%= nameProperCase %>Model, <%= nameProperCase %>Options>;


    id: string;
    constructor(modelId: string, _options: <%= nameProperCase %>Options) {
        this.id = modelId;
        // Container is automatically injected with parentId: modelId
    }

    updateModel(_options: <%= nameProperCase %>Options): void {
        // Copy fields in place (verbatim; derive in computed getters, not here).
    }
    // -------------------LIFECYCLE----------------------------
    

    async init(): Promise<void> {
        this.logger.debug(`initializing <%= nameLowerCase %> container ${this.id}` );
    }


    async load(): Promise<void> {
        this.logger.debug(`loading <%= nameLowerCase %> container ${this.id}`);
    }



}
export const <%= nameProperCase %> = <%= nameProperCase %>ModelImpl.Registration;


<%= nameProperCase %>.addRelatedModel(<%= modelNameProperCase %>);