import { IParam } from '@core';
import { {{pascalCase appEntity.codeName}}UIServiceBase } from './{{spinalCase appEntity.codeName}}-ui-service-base';

/**
 * {{appEntity.logicName}}UI服务
 *
 * @export
 * @class {{pascalCase appEntity.codeName}}UIService
 * @extends {{pascalCase appEntity.codeName}}UIServiceBase
 */
export class {{pascalCase appEntity.codeName}}UIService extends {{pascalCase appEntity.codeName}}UIServiceBase {

    /**
     * 基础UI服务实例
     * 
     * @private
     * @type { {{pascalCase appEntity.codeName}}UIService }
     * @memberof {{pascalCase appEntity.codeName}}UIService
     */
    private static basicUIServiceInstance: {{pascalCase appEntity.codeName}}UIService;

    /**
     * UI服务存储Map对象
     *
     * @private
     * @type {Map<string, any>}
     * @memberof {{pascalCase appEntity.codeName}}UIService
     */
    private static UIServiceMap: Map<string, any> = new Map();

    /**
     * Creates an instance of {{pascalCase appEntity.codeName}}UIService.
     * @memberof {{pascalCase appEntity.codeName}}UIService
     */
    constructor(opts?: IParam) {
        super(opts);
    }

    /**
     * 获取实例
     *
     * @static
     * @param 应用上下文
     * @return {*}  { {{pascalCase appEntity.codeName}}UIService }
     * @memberof {{pascalCase appEntity.codeName}}UIService
     */
    static getInstance(opts?: IParam): {{pascalCase appEntity.codeName}}UIService {
         if (!this.basicUIServiceInstance) {
            this.basicUIServiceInstance = new {{pascalCase appEntity.codeName}}UIService(opts);
        }
        if (!opts || !opts.srfdynainstid) {
            return this.basicUIServiceInstance;
        } else {
            if (!{{pascalCase appEntity.codeName}}UIService.UIServiceMap.get(opts.srfdynainstid)) {
                {{pascalCase appEntity.codeName}}UIService.UIServiceMap.set(opts.srfdynainstid, new {{pascalCase appEntity.codeName}}UIService(opts));
            }
            return {{pascalCase appEntity.codeName}}UIService.UIServiceMap.get(opts.srfdynainstid);
        }
    }
}
export default {{pascalCase appEntity.codeName}}UIService;