import { FieldInfo } from 'model-util-base'
import { ConditionUtil, ConditionUtilImpl, FieldUtil, TableUtilImpl, IdType, JoinTable, SubTable } from 'model-util'
import { Container, Singleton } from 'typescript-ioc' 
import { DevopsTaskApp } from '../models/index' 

import {DevopsAppMU} from './DevopsApp' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-06-24 17:22
 */
interface DevopsTaskAppCU extends ConditionUtil<DevopsTaskAppCU>{
    ID:FieldUtil<DevopsTaskAppCU>;
    TASK_ID:FieldUtil<DevopsTaskAppCU>;
    APP_ID:FieldUtil<DevopsTaskAppCU>;
    SORT_INDEX:FieldUtil<DevopsTaskAppCU>;
    OLD_VERSION:FieldUtil<DevopsTaskAppCU>;
    NEW_VERSION:FieldUtil<DevopsTaskAppCU>;
    RUN_STATE:FieldUtil<DevopsTaskAppCU>;
    CREATE_TIME:FieldUtil<DevopsTaskAppCU>;
    UPDATE_TIME:FieldUtil<DevopsTaskAppCU>;
    ENABLED:FieldUtil<DevopsTaskAppCU>;
}

class DevopsTaskAppCUImpl extends ConditionUtilImpl<DevopsTaskAppCUImpl> implements DevopsTaskAppCU{ 
    newInstance(): DevopsTaskAppCUImpl {
        return new DevopsTaskAppCUImpl();
    } 
    get ID(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('id','id','主键', this);
    }
    get TASK_ID(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('task_id','taskId','任务id', this);
    }
    get APP_ID(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('app_id','appId','应用id', this);
    }
    get SORT_INDEX(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('sort_index','sortIndex','升级顺序', this);
    }
    get OLD_VERSION(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('old_version','oldVersion','当前版本', this);
    }
    get NEW_VERSION(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('new_version','newVersion','升级版本', this);
    }
    get RUN_STATE(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('run_state','runState','升级状态（0-升级；1-回滚）', this);
    }
    get CREATE_TIME(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('create_time','createTime','', this);
    }
    get UPDATE_TIME(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('update_time','updateTime','', this);
    }
    get ENABLED(): FieldUtil<DevopsTaskAppCU>{  
        return new FieldUtil('enabled','enabled','', this);
    }
    get APP_NAME(): FieldInfo{  
        return new FieldInfo('appName','应用名称');
    }
    get APP_TYPE(): FieldInfo{  
        return new FieldInfo('appType','应用类型：0-deamon应用；1-web应用');
    }
    get CURRENT_VERSION(): FieldInfo{  
        return new FieldInfo('currentVersion','当前版本');
    }
    get HEALTH_URL(): FieldInfo{  
        return new FieldInfo('healthUrl','健康检查url');
    }
    get HOST_IP(): FieldInfo{  
        return new FieldInfo('hostIp','主机IP，多个时逗号隔开');
    }
    get INSTANCE_NAME(): FieldInfo{  
        return new FieldInfo('instanceName','主机名称');
    }
    get INSTANCE_ID(): FieldInfo{  
        return new FieldInfo('instanceId','主机实例id');
    }
    get CONTEXT(): FieldInfo{  
        return new FieldInfo('context','上下文');
    }
    get APP_PORT(): FieldInfo{  
        return new FieldInfo('appPort','应用端口');
    }
}

@Singleton 
class DevopsTaskAppMU extends TableUtilImpl<DevopsTaskAppCU,DevopsTaskApp>{ 
    tableName  = 'devops_task_app';
    tableFields  = ['id','task_id','app_id','sort_index','old_version','new_version','run_state','create_time','update_time','enabled'];
    modelFields  = ['id','taskId','appId','sortIndex','oldVersion','newVersion','runState','createTime','updateTime','enabled','appName','appType','currentVersion','healthUrl','hostIp','instanceName','instanceId','context','appPort'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [DevopsTaskAppMU.APP_ID],
            joinIdFields: [DevopsAppMU.ID],
            getTableUtil: ()=>{
                return Container.get(DevopsAppMU);
            },
            fields: [
                {
                    fieldUtil: DevopsAppMU.APP_NAME,
                    alias: 'appName'
                }
                ,{
                    fieldUtil: DevopsAppMU.APP_TYPE,
                    alias: 'appType'
                }
                ,{
                    fieldUtil: DevopsAppMU.CURRENT_VERSION,
                    alias: 'currentVersion'
                }
                ,{
                    fieldUtil: DevopsAppMU.HEALTH_URL,
                    alias: 'healthUrl'
                }
                ,{
                    fieldUtil: DevopsAppMU.HOST_IP,
                    alias: 'hostIp'
                }
                ,{
                    fieldUtil: DevopsAppMU.INSTANCE_NAME,
                    alias: 'instanceName'
                }
                ,{
                    fieldUtil: DevopsAppMU.INSTANCE_ID,
                    alias: 'instanceId'
                }
                ,{
                    fieldUtil: DevopsAppMU.CONTEXT,
                    alias: 'context'
                }
                ,{
                    fieldUtil: DevopsAppMU.APP_PORT,
                    alias: 'appPort'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): DevopsTaskAppCU {
        return new DevopsTaskAppCUImpl();
    }   

    static get ID(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('id','id','主键', new DevopsTaskAppCUImpl());
    }
    static get TASK_ID(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('task_id','taskId','任务id', new DevopsTaskAppCUImpl());
    }
    static get APP_ID(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('app_id','appId','应用id', new DevopsTaskAppCUImpl());
    }
    static get SORT_INDEX(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('sort_index','sortIndex','升级顺序', new DevopsTaskAppCUImpl());
    }
    static get OLD_VERSION(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('old_version','oldVersion','当前版本', new DevopsTaskAppCUImpl());
    }
    static get NEW_VERSION(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('new_version','newVersion','升级版本', new DevopsTaskAppCUImpl());
    }
    static get RUN_STATE(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('run_state','runState','升级状态（0-升级；1-回滚）', new DevopsTaskAppCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('create_time','createTime','', new DevopsTaskAppCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('update_time','updateTime','', new DevopsTaskAppCUImpl());
    }
    static get ENABLED(): FieldUtil<DevopsTaskAppCU>{ 
        return new FieldUtil('enabled','enabled','', new DevopsTaskAppCUImpl());
    }
    static get APP_NAME(): FieldInfo{  
        return new FieldInfo('appName','应用名称');
    }
    static get APP_TYPE(): FieldInfo{  
        return new FieldInfo('appType','应用类型：0-deamon应用；1-web应用');
    }
    static get CURRENT_VERSION(): FieldInfo{  
        return new FieldInfo('currentVersion','当前版本');
    }
    static get HEALTH_URL(): FieldInfo{  
        return new FieldInfo('healthUrl','健康检查url');
    }
    static get HOST_IP(): FieldInfo{  
        return new FieldInfo('hostIp','主机IP，多个时逗号隔开');
    }
    static get INSTANCE_NAME(): FieldInfo{  
        return new FieldInfo('instanceName','主机名称');
    }
    static get INSTANCE_ID(): FieldInfo{  
        return new FieldInfo('instanceId','主机实例id');
    }
    static get CONTEXT(): FieldInfo{  
        return new FieldInfo('context','上下文');
    }
    static get APP_PORT(): FieldInfo{  
        return new FieldInfo('appPort','应用端口');
    }

    get ID(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.ID;
    }
    get TASK_ID(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.TASK_ID;
    }
    get APP_ID(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.APP_ID;
    }
    get SORT_INDEX(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.SORT_INDEX;
    }
    get OLD_VERSION(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.OLD_VERSION;
    }
    get NEW_VERSION(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.NEW_VERSION;
    }
    get RUN_STATE(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.RUN_STATE;
    }
    get CREATE_TIME(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.UPDATE_TIME;
    }
    get ENABLED(): FieldUtil<DevopsTaskAppCU>{ 
        return DevopsTaskAppMU.ENABLED;
    }
    get APP_NAME(): FieldInfo{  
        return DevopsTaskAppMU.APP_NAME;
    }
    get APP_TYPE(): FieldInfo{  
        return DevopsTaskAppMU.APP_TYPE;
    }
    get CURRENT_VERSION(): FieldInfo{  
        return DevopsTaskAppMU.CURRENT_VERSION;
    }
    get HEALTH_URL(): FieldInfo{  
        return DevopsTaskAppMU.HEALTH_URL;
    }
    get HOST_IP(): FieldInfo{  
        return DevopsTaskAppMU.HOST_IP;
    }
    get INSTANCE_NAME(): FieldInfo{  
        return DevopsTaskAppMU.INSTANCE_NAME;
    }
    get INSTANCE_ID(): FieldInfo{  
        return DevopsTaskAppMU.INSTANCE_ID;
    }
    get CONTEXT(): FieldInfo{  
        return DevopsTaskAppMU.CONTEXT;
    }
    get APP_PORT(): FieldInfo{  
        return DevopsTaskAppMU.APP_PORT;
    }
}
export {DevopsTaskAppMU, DevopsTaskAppCU}
