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

import {SysServiceCenterMU} from './SysServiceCenter' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-04-29 11:04
 */
interface QuickTaskCU extends ConditionUtil<QuickTaskCU>{
    ID:FieldUtil<QuickTaskCU>;
    SERVICE_CENTER_ID:FieldUtil<QuickTaskCU>;
    APP_ID:FieldUtil<QuickTaskCU>;
    TASK_TYPE:FieldUtil<QuickTaskCU>;
    TASK_CODE:FieldUtil<QuickTaskCU>;
    TASK_NAME:FieldUtil<QuickTaskCU>;
    DESCRIPTION:FieldUtil<QuickTaskCU>;
    CRON:FieldUtil<QuickTaskCU>;
    MAX_COST_TIME:FieldUtil<QuickTaskCU>;
    TASK_CONTENT:FieldUtil<QuickTaskCU>;
    DELETED:FieldUtil<QuickTaskCU>;
    ENABLED:FieldUtil<QuickTaskCU>;
    CHANGED:FieldUtil<QuickTaskCU>;
    LAST_RUN_TIME:FieldUtil<QuickTaskCU>;
    ENABLE_ALERT:FieldUtil<QuickTaskCU>;
    ALERT_CRON:FieldUtil<QuickTaskCU>;
    ALERT_TEMPLATE_ID:FieldUtil<QuickTaskCU>;
    CREATE_TIME:FieldUtil<QuickTaskCU>;
    UPDATE_TIME:FieldUtil<QuickTaskCU>;
}

class QuickTaskCUImpl extends ConditionUtilImpl<QuickTaskCUImpl> implements QuickTaskCU{ 
    newInstance(): QuickTaskCUImpl {
        return new QuickTaskCUImpl();
    } 
    get ID(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('ID','id','id', this);
    }
    get SERVICE_CENTER_ID(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('SERVICE_CENTER_ID','serviceCenterId','服务中心id', this);
    }
    get APP_ID(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('APP_ID','appId','应用id', this);
    }
    get TASK_TYPE(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('TASK_TYPE','taskType','任务类型（01-url调用；02-中台服务调用）', this);
    }
    get TASK_CODE(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('TASK_CODE','taskCode','任务编号', this);
    }
    get TASK_NAME(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('TASK_NAME','taskName','任务名称', this);
    }
    get DESCRIPTION(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('DESCRIPTION','description','概要介绍', this);
    }
    get CRON(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('CRON','cron','Cron表达式', this);
    }
    get MAX_COST_TIME(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('MAX_COST_TIME','maxCostTime','预计最大耗时', this);
    }
    get TASK_CONTENT(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('TASK_CONTENT','taskContent','任务内容', this);
    }
    get DELETED(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('DELETED','deleted','deleted', this);
    }
    get ENABLED(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('ENABLED','enabled','是否启用', this);
    }
    get CHANGED(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('CHANGED','changed','增删改为true，调度后为false', this);
    }
    get LAST_RUN_TIME(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('LAST_RUN_TIME','lastRunTime','last_run_time', this);
    }
    get ENABLE_ALERT(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('ENABLE_ALERT','enableAlert','enable_alert', this);
    }
    get ALERT_CRON(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('ALERT_CRON','alertCron','alert_cron', this);
    }
    get ALERT_TEMPLATE_ID(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('ALERT_TEMPLATE_ID','alertTemplateId','alert_template_id', this);
    }
    get CREATE_TIME(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('CREATE_TIME','createTime','create_time', this);
    }
    get UPDATE_TIME(): FieldUtil<QuickTaskCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','update_time', this);
    }
    get SERVICE_CENTER_NAME11(): FieldInfo{  
        return new FieldInfo('serviceCenterName11','名称');
    }
}

@Singleton 
class QuickTaskMU extends TableUtilImpl<QuickTaskCU,QuickTask>{ 
    tableName  = 'quick_task';
    tableFields  = ['id','service_center_id','app_id','task_type','task_code','task_name','description','cron','max_cost_time','task_content','deleted','enabled','changed','last_run_time','enable_alert','alert_cron','alert_template_id','create_time','update_time'];
    modelFields  = ['id','serviceCenterId','appId','taskType','taskCode','taskName','description','cron','maxCostTime','taskContent','deleted','enabled','changed','lastRunTime','enableAlert','alertCron','alertTemplateId','createTime','updateTime','serviceCenterName11'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [QuickTaskMU.SERVICE_CENTER_ID],
            joinIdFields: [SysServiceCenterMU.ID],
            getTableUtil: ()=>{
                return Container.get(SysServiceCenterMU);
            },
            fields: [
                {
                    fieldUtil: SysServiceCenterMU.NAME,
                    alias: 'serviceCenterName11'
                }
            ]

        } as JoinTable

];
    subTables = [{
            name: 'sysServiceCenter',
            parentIdFields: [QuickTaskMU.SERVICE_CENTER_ID],
            foreignKeyFields: [SysServiceCenterMU.ID],
            getTableUtil: ()=>{
                return Container.get(SysServiceCenterMU);
            }
        } as SubTable

];

    createConditionUtil(): QuickTaskCU {
        return new QuickTaskCUImpl();
    }   

    static get ID(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('ID','id','id', new QuickTaskCUImpl());
    }
    static get SERVICE_CENTER_ID(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('SERVICE_CENTER_ID','serviceCenterId','服务中心id', new QuickTaskCUImpl());
    }
    static get APP_ID(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('APP_ID','appId','应用id', new QuickTaskCUImpl());
    }
    static get TASK_TYPE(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('TASK_TYPE','taskType','任务类型（01-url调用；02-中台服务调用）', new QuickTaskCUImpl());
    }
    static get TASK_CODE(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('TASK_CODE','taskCode','任务编号', new QuickTaskCUImpl());
    }
    static get TASK_NAME(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('TASK_NAME','taskName','任务名称', new QuickTaskCUImpl());
    }
    static get DESCRIPTION(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('DESCRIPTION','description','概要介绍', new QuickTaskCUImpl());
    }
    static get CRON(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('CRON','cron','Cron表达式', new QuickTaskCUImpl());
    }
    static get MAX_COST_TIME(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('MAX_COST_TIME','maxCostTime','预计最大耗时', new QuickTaskCUImpl());
    }
    static get TASK_CONTENT(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('TASK_CONTENT','taskContent','任务内容', new QuickTaskCUImpl());
    }
    static get DELETED(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('DELETED','deleted','deleted', new QuickTaskCUImpl());
    }
    static get ENABLED(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('ENABLED','enabled','是否启用', new QuickTaskCUImpl());
    }
    static get CHANGED(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('CHANGED','changed','增删改为true，调度后为false', new QuickTaskCUImpl());
    }
    static get LAST_RUN_TIME(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('LAST_RUN_TIME','lastRunTime','last_run_time', new QuickTaskCUImpl());
    }
    static get ENABLE_ALERT(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('ENABLE_ALERT','enableAlert','enable_alert', new QuickTaskCUImpl());
    }
    static get ALERT_CRON(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('ALERT_CRON','alertCron','alert_cron', new QuickTaskCUImpl());
    }
    static get ALERT_TEMPLATE_ID(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('ALERT_TEMPLATE_ID','alertTemplateId','alert_template_id', new QuickTaskCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','create_time', new QuickTaskCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<QuickTaskCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','update_time', new QuickTaskCUImpl());
    }
    static get SERVICE_CENTER_NAME11(): FieldInfo{  
        return new FieldInfo('serviceCenterName11','名称');
    }

    get ID(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.ID;
    }
    get SERVICE_CENTER_ID(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.SERVICE_CENTER_ID;
    }
    get APP_ID(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.APP_ID;
    }
    get TASK_TYPE(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.TASK_TYPE;
    }
    get TASK_CODE(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.TASK_CODE;
    }
    get TASK_NAME(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.TASK_NAME;
    }
    get DESCRIPTION(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.DESCRIPTION;
    }
    get CRON(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.CRON;
    }
    get MAX_COST_TIME(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.MAX_COST_TIME;
    }
    get TASK_CONTENT(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.TASK_CONTENT;
    }
    get DELETED(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.DELETED;
    }
    get ENABLED(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.ENABLED;
    }
    get CHANGED(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.CHANGED;
    }
    get LAST_RUN_TIME(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.LAST_RUN_TIME;
    }
    get ENABLE_ALERT(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.ENABLE_ALERT;
    }
    get ALERT_CRON(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.ALERT_CRON;
    }
    get ALERT_TEMPLATE_ID(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.ALERT_TEMPLATE_ID;
    }
    get CREATE_TIME(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<QuickTaskCU>{ 
        return QuickTaskMU.UPDATE_TIME;
    }
    get SERVICE_CENTER_NAME11(): FieldInfo{  
        return QuickTaskMU.SERVICE_CENTER_NAME11;
    }
}
export {QuickTaskMU, QuickTaskCU}
