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

import {DevopsUserMU} from './DevopsUser' 
import {DevopsTaskMU} from './DevopsTask' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-06-08 17:20
 */
interface DevopsTaskNoticeQueueCU extends ConditionUtil<DevopsTaskNoticeQueueCU>{
    ID:FieldUtil<DevopsTaskNoticeQueueCU>;
    TASK_ID:FieldUtil<DevopsTaskNoticeQueueCU>;
    STATE:FieldUtil<DevopsTaskNoticeQueueCU>;
    OPERATOR_USER_ID:FieldUtil<DevopsTaskNoticeQueueCU>;
    PLAN_TIME:FieldUtil<DevopsTaskNoticeQueueCU>;
}

class DevopsTaskNoticeQueueCUImpl extends ConditionUtilImpl<DevopsTaskNoticeQueueCUImpl> implements DevopsTaskNoticeQueueCU{ 
    newInstance(): DevopsTaskNoticeQueueCUImpl {
        return new DevopsTaskNoticeQueueCUImpl();
    } 
    get ID(): FieldUtil<DevopsTaskNoticeQueueCU>{  
        return new FieldUtil('id','id','', this);
    }
    get TASK_ID(): FieldUtil<DevopsTaskNoticeQueueCU>{  
        return new FieldUtil('task_id','taskId','', this);
    }
    get STATE(): FieldUtil<DevopsTaskNoticeQueueCU>{  
        return new FieldUtil('state','state','任务通知推送状态（1已推送,0未推送）', this);
    }
    get OPERATOR_USER_ID(): FieldUtil<DevopsTaskNoticeQueueCU>{  
        return new FieldUtil('operator_user_id','operatorUserId','', this);
    }
    get PLAN_TIME(): FieldUtil<DevopsTaskNoticeQueueCU>{  
        return new FieldUtil('plan_time','planTime','', this);
    }
    get EWECHAT_USER_ID(): FieldInfo{  
        return new FieldInfo('ewechatUserId','');
    }
    get TASK_NAME(): FieldInfo{  
        return new FieldInfo('taskName','任务名称');
    }
}

@Singleton 
class DevopsTaskNoticeQueueMU extends TableUtilImpl<DevopsTaskNoticeQueueCU,DevopsTaskNoticeQueue>{ 
    tableName  = 'devops_task_notice_queue';
    tableFields  = ['id','task_id','state','operator_user_id','plan_time'];
    modelFields  = ['id','taskId','state','operatorUserId','planTime','ewechatUserId','taskName'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [DevopsTaskNoticeQueueMU.OPERATOR_USER_ID],
            joinIdFields: [DevopsUserMU.ID],
            getTableUtil: ()=>{
                return Container.get(DevopsUserMU);
            },
            fields: [
                {
                    fieldUtil: DevopsUserMU.EWECHAT_USER_ID,
                    alias: 'ewechatUserId'
                }
            ]

        } as JoinTable

        ,{
            joinByDefault: true,
            foreignKeyFields: [DevopsTaskNoticeQueueMU.TASK_ID],
            joinIdFields: [DevopsTaskMU.ID],
            getTableUtil: ()=>{
                return Container.get(DevopsTaskMU);
            },
            fields: [
                {
                    fieldUtil: DevopsTaskMU.TASK_NAME,
                    alias: 'taskName'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): DevopsTaskNoticeQueueCU {
        return new DevopsTaskNoticeQueueCUImpl();
    }   

    static get ID(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return new FieldUtil('id','id','', new DevopsTaskNoticeQueueCUImpl());
    }
    static get TASK_ID(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return new FieldUtil('task_id','taskId','', new DevopsTaskNoticeQueueCUImpl());
    }
    static get STATE(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return new FieldUtil('state','state','任务通知推送状态（1已推送,0未推送）', new DevopsTaskNoticeQueueCUImpl());
    }
    static get OPERATOR_USER_ID(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return new FieldUtil('operator_user_id','operatorUserId','', new DevopsTaskNoticeQueueCUImpl());
    }
    static get PLAN_TIME(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return new FieldUtil('plan_time','planTime','', new DevopsTaskNoticeQueueCUImpl());
    }
    static get EWECHAT_USER_ID(): FieldInfo{  
        return new FieldInfo('ewechatUserId','');
    }
    static get TASK_NAME(): FieldInfo{  
        return new FieldInfo('taskName','任务名称');
    }

    get ID(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return DevopsTaskNoticeQueueMU.ID;
    }
    get TASK_ID(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return DevopsTaskNoticeQueueMU.TASK_ID;
    }
    get STATE(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return DevopsTaskNoticeQueueMU.STATE;
    }
    get OPERATOR_USER_ID(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return DevopsTaskNoticeQueueMU.OPERATOR_USER_ID;
    }
    get PLAN_TIME(): FieldUtil<DevopsTaskNoticeQueueCU>{ 
        return DevopsTaskNoticeQueueMU.PLAN_TIME;
    }
    get EWECHAT_USER_ID(): FieldInfo{  
        return DevopsTaskNoticeQueueMU.EWECHAT_USER_ID;
    }
    get TASK_NAME(): FieldInfo{  
        return DevopsTaskNoticeQueueMU.TASK_NAME;
    }
}
export {DevopsTaskNoticeQueueMU, DevopsTaskNoticeQueueCU}
