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

import {MonitorContactGroupRelMU} from './MonitorContactGroupRel' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-09-15 13:46
 */
interface MonitorRulesettingContactRelCU extends ConditionUtil<MonitorRulesettingContactRelCU>{
    ID:FieldUtil<MonitorRulesettingContactRelCU>;
    SETTING_ID:FieldUtil<MonitorRulesettingContactRelCU>;
    CONTACT_GROUP_ID:FieldUtil<MonitorRulesettingContactRelCU>;
    DELETED:FieldUtil<MonitorRulesettingContactRelCU>;
    CREATE_TIME:FieldUtil<MonitorRulesettingContactRelCU>;
    UPDATE_TIME:FieldUtil<MonitorRulesettingContactRelCU>;
}

class MonitorRulesettingContactRelCUImpl extends ConditionUtilImpl<MonitorRulesettingContactRelCUImpl> implements MonitorRulesettingContactRelCU{ 
    newInstance(): MonitorRulesettingContactRelCUImpl {
        return new MonitorRulesettingContactRelCUImpl();
    } 
    get ID(): FieldUtil<MonitorRulesettingContactRelCU>{  
        return new FieldUtil('id','id','主键', this);
    }
    get SETTING_ID(): FieldUtil<MonitorRulesettingContactRelCU>{  
        return new FieldUtil('setting_id','settingId','规则设置id', this);
    }
    get CONTACT_GROUP_ID(): FieldUtil<MonitorRulesettingContactRelCU>{  
        return new FieldUtil('contact_group_id','contactGroupId','联系组id', this);
    }
    get DELETED(): FieldUtil<MonitorRulesettingContactRelCU>{  
        return new FieldUtil('deleted','deleted','deleted', this);
    }
    get CREATE_TIME(): FieldUtil<MonitorRulesettingContactRelCU>{  
        return new FieldUtil('create_time','createTime','create_time', this);
    }
    get UPDATE_TIME(): FieldUtil<MonitorRulesettingContactRelCU>{  
        return new FieldUtil('update_time','updateTime','update_time', this);
    }
    get CONTACT_PHONE(): FieldInfo{  
        return new FieldInfo('contactPhone','电话');
    }
    get CONTACT_ID(): FieldInfo{  
        return new FieldInfo('contactId','联系人id');
    }
}

@Singleton 
class MonitorRulesettingContactRelMU extends TableUtilImpl<MonitorRulesettingContactRelCU,MonitorRulesettingContactRel>{ 
    tableName  = 'monitor_rulesetting_contact_rel';
    tableFields  = ['id','setting_id','contact_group_id','deleted','create_time','update_time'];
    modelFields  = ['id','settingId','contactGroupId','deleted','createTime','updateTime','contactPhone','contactId'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [MonitorRulesettingContactRelMU.CONTACT_GROUP_ID,MonitorRulesettingContactRelMU.DELETED],
            joinIdFields: [MonitorContactGroupRelMU.GROUP_ID,MonitorContactGroupRelMU.DELETED],
            getTableUtil: ()=>{
                return Container.get(MonitorContactGroupRelMU);
            },
            fields: [
                {
                    fieldUtil: MonitorContactGroupRelMU.CONTACT_PHONE,
                    alias: 'contactPhone'
                }
                ,{
                    fieldUtil: MonitorContactGroupRelMU.CONTACT_ID,
                    alias: 'contactId'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): MonitorRulesettingContactRelCU {
        return new MonitorRulesettingContactRelCUImpl();
    }   

    static get ID(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return new FieldUtil('id','id','主键', new MonitorRulesettingContactRelCUImpl());
    }
    static get SETTING_ID(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return new FieldUtil('setting_id','settingId','规则设置id', new MonitorRulesettingContactRelCUImpl());
    }
    static get CONTACT_GROUP_ID(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return new FieldUtil('contact_group_id','contactGroupId','联系组id', new MonitorRulesettingContactRelCUImpl());
    }
    static get DELETED(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return new FieldUtil('deleted','deleted','deleted', new MonitorRulesettingContactRelCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return new FieldUtil('create_time','createTime','create_time', new MonitorRulesettingContactRelCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return new FieldUtil('update_time','updateTime','update_time', new MonitorRulesettingContactRelCUImpl());
    }
    static get CONTACT_PHONE(): FieldInfo{  
        return new FieldInfo('contactPhone','电话');
    }
    static get CONTACT_ID(): FieldInfo{  
        return new FieldInfo('contactId','联系人id');
    }

    get ID(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return MonitorRulesettingContactRelMU.ID;
    }
    get SETTING_ID(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return MonitorRulesettingContactRelMU.SETTING_ID;
    }
    get CONTACT_GROUP_ID(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return MonitorRulesettingContactRelMU.CONTACT_GROUP_ID;
    }
    get DELETED(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return MonitorRulesettingContactRelMU.DELETED;
    }
    get CREATE_TIME(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return MonitorRulesettingContactRelMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<MonitorRulesettingContactRelCU>{ 
        return MonitorRulesettingContactRelMU.UPDATE_TIME;
    }
    get CONTACT_PHONE(): FieldInfo{  
        return MonitorRulesettingContactRelMU.CONTACT_PHONE;
    }
    get CONTACT_ID(): FieldInfo{  
        return MonitorRulesettingContactRelMU.CONTACT_ID;
    }
}
export {MonitorRulesettingContactRelMU, MonitorRulesettingContactRelCU}
