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

import {DevopsFlowMU} from './DevopsFlow' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-06-24 17:42
 */
interface DevopsFlowStepCU extends ConditionUtil<DevopsFlowStepCU>{
    ID:FieldUtil<DevopsFlowStepCU>;
    FLOW_ID:FieldUtil<DevopsFlowStepCU>;
    STEP_INDEX:FieldUtil<DevopsFlowStepCU>;
    STEP_TYPE:FieldUtil<DevopsFlowStepCU>;
    STEP_NAME:FieldUtil<DevopsFlowStepCU>;
    STEP_DESC:FieldUtil<DevopsFlowStepCU>;
    RUN_SCRIPT_TEMPLATE:FieldUtil<DevopsFlowStepCU>;
    REMARK:FieldUtil<DevopsFlowStepCU>;
    CREATE_TIME:FieldUtil<DevopsFlowStepCU>;
    UPDATE_TIME:FieldUtil<DevopsFlowStepCU>;
}

class DevopsFlowStepCUImpl extends ConditionUtilImpl<DevopsFlowStepCUImpl> implements DevopsFlowStepCU{ 
    newInstance(): DevopsFlowStepCUImpl {
        return new DevopsFlowStepCUImpl();
    } 
    get ID(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('id','id','主键', this);
    }
    get FLOW_ID(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('flow_id','flowId','流程id', this);
    }
    get STEP_INDEX(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('step_index','stepIndex','执行顺序', this);
    }
    get STEP_TYPE(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('step_type','stepType','步骤类型：10-空步骤11-等待x分钟21-ng关22-ng开31-应用升级32-应用开启33-应用', this);
    }
    get STEP_NAME(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('step_name','stepName','步骤名称', this);
    }
    get STEP_DESC(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('step_desc','stepDesc','步骤描述', this);
    }
    get RUN_SCRIPT_TEMPLATE(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('run_script_template','runScriptTemplate','运行脚本模板', this);
    }
    get REMARK(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('remark','remark','备注', this);
    }
    get CREATE_TIME(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('create_time','createTime','创建时间', this);
    }
    get UPDATE_TIME(): FieldUtil<DevopsFlowStepCU>{  
        return new FieldUtil('update_time','updateTime','更新时间', this);
    }
    get FLOW_NAME(): FieldInfo{  
        return new FieldInfo('flowName','流程名称');
    }
}

@Singleton 
class DevopsFlowStepMU extends TableUtilImpl<DevopsFlowStepCU,DevopsFlowStep>{ 
    tableName  = 'devops_flow_step';
    tableFields  = ['id','flow_id','step_index','step_type','step_name','step_desc','run_script_template','remark','create_time','update_time'];
    modelFields  = ['id','flowId','stepIndex','stepType','stepName','stepDesc','runScriptTemplate','remark','createTime','updateTime','flowName'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [DevopsFlowStepMU.FLOW_ID],
            joinIdFields: [DevopsFlowMU.ID],
            getTableUtil: ()=>{
                return Container.get(DevopsFlowMU);
            },
            fields: [
                {
                    fieldUtil: DevopsFlowMU.FLOW_NAME,
                    alias: 'flowName'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): DevopsFlowStepCU {
        return new DevopsFlowStepCUImpl();
    }   

    static get ID(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('id','id','主键', new DevopsFlowStepCUImpl());
    }
    static get FLOW_ID(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('flow_id','flowId','流程id', new DevopsFlowStepCUImpl());
    }
    static get STEP_INDEX(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('step_index','stepIndex','执行顺序', new DevopsFlowStepCUImpl());
    }
    static get STEP_TYPE(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('step_type','stepType','步骤类型：10-空步骤11-等待x分钟21-ng关22-ng开31-应用升级32-应用开启33-应用', new DevopsFlowStepCUImpl());
    }
    static get STEP_NAME(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('step_name','stepName','步骤名称', new DevopsFlowStepCUImpl());
    }
    static get STEP_DESC(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('step_desc','stepDesc','步骤描述', new DevopsFlowStepCUImpl());
    }
    static get RUN_SCRIPT_TEMPLATE(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('run_script_template','runScriptTemplate','运行脚本模板', new DevopsFlowStepCUImpl());
    }
    static get REMARK(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('remark','remark','备注', new DevopsFlowStepCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('create_time','createTime','创建时间', new DevopsFlowStepCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<DevopsFlowStepCU>{ 
        return new FieldUtil('update_time','updateTime','更新时间', new DevopsFlowStepCUImpl());
    }
    static get FLOW_NAME(): FieldInfo{  
        return new FieldInfo('flowName','流程名称');
    }

    get ID(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.ID;
    }
    get FLOW_ID(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.FLOW_ID;
    }
    get STEP_INDEX(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.STEP_INDEX;
    }
    get STEP_TYPE(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.STEP_TYPE;
    }
    get STEP_NAME(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.STEP_NAME;
    }
    get STEP_DESC(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.STEP_DESC;
    }
    get RUN_SCRIPT_TEMPLATE(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.RUN_SCRIPT_TEMPLATE;
    }
    get REMARK(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.REMARK;
    }
    get CREATE_TIME(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<DevopsFlowStepCU>{ 
        return DevopsFlowStepMU.UPDATE_TIME;
    }
    get FLOW_NAME(): FieldInfo{  
        return DevopsFlowStepMU.FLOW_NAME;
    }
}
export {DevopsFlowStepMU, DevopsFlowStepCU}
