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

import {CnGatewayMU} from './CnGateway' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-11-11 14:27
 */
interface CnProjectContextCU extends ConditionUtil<CnProjectContextCU>{
    ID:FieldUtil<CnProjectContextCU>;
    PROJECT_ID:FieldUtil<CnProjectContextCU>;
    GATEWAY:FieldUtil<CnProjectContextCU>;
    URI:FieldUtil<CnProjectContextCU>;
    DELETED:FieldUtil<CnProjectContextCU>;
    CREATE_USER_ID:FieldUtil<CnProjectContextCU>;
    CREATE_TIME:FieldUtil<CnProjectContextCU>;
    ENV_ID:FieldUtil<CnProjectContextCU>;
    ENV_CODE:FieldUtil<CnProjectContextCU>;
}

class CnProjectContextCUImpl extends ConditionUtilImpl<CnProjectContextCUImpl> implements CnProjectContextCU{ 
    newInstance(): CnProjectContextCUImpl {
        return new CnProjectContextCUImpl();
    } 
    get ID(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('id','id','主键', this);
    }
    get PROJECT_ID(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('project_id','projectId','项目主键', this);
    }
    get GATEWAY(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('gateway','gateway','网关', this);
    }
    get URI(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('uri','uri','URI', this);
    }
    get DELETED(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('deleted','deleted','删除标记', this);
    }
    get CREATE_USER_ID(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('create_user_id','createUserId','创建人', this);
    }
    get CREATE_TIME(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('create_time','createTime','创建时间', this);
    }
    get ENV_ID(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('env_id','envId','环境ID', this);
    }
    get ENV_CODE(): FieldUtil<CnProjectContextCU>{  
        return new FieldUtil('env_code','envCode','TEST/PROD...', this);
    }
    get CN_SLB_ID(): FieldInfo{  
        return new FieldInfo('cnSlbId','阿里云/华为云SLBID');
    }
    get SLB_IP(): FieldInfo{  
        return new FieldInfo('slbIp','服务地址');
    }
    get SLB_ADMIN_PORT(): FieldInfo{  
        return new FieldInfo('slbAdminPort','SLB映射管理端口号');
    }
    get SLB_SERVICE_PORT(): FieldInfo{  
        return new FieldInfo('slbServicePort','SLB映射服务端口号');
    }
}

@Singleton 
class CnProjectContextMU extends TableUtilImpl<CnProjectContextCU,CnProjectContext>{ 
    tableName  = 'cn_project_context';
    tableFields  = ['id','project_id','gateway','uri','deleted','create_user_id','create_time','env_id','env_code'];
    modelFields  = ['id','projectId','gateway','uri','deleted','createUserId','createTime','envId','envCode','cnSlbId','slbIp','slbAdminPort','slbServicePort'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: true,
            foreignKeyFields: [CnProjectContextMU.GATEWAY,CnProjectContextMU.DELETED],
            joinIdFields: [CnGatewayMU.ID,CnGatewayMU.DELETED],
            getTableUtil: ()=>{
                return Container.get(CnGatewayMU);
            },
            fields: [
                {
                    fieldUtil: CnGatewayMU.CN_SLB_ID,
                    alias: 'cnSlbId'
                }
                ,{
                    fieldUtil: CnGatewayMU.SLB_IP,
                    alias: 'slbIp'
                }
                ,{
                    fieldUtil: CnGatewayMU.SLB_ADMIN_PORT,
                    alias: 'slbAdminPort'
                }
                ,{
                    fieldUtil: CnGatewayMU.SLB_SERVICE_PORT,
                    alias: 'slbServicePort'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): CnProjectContextCU {
        return new CnProjectContextCUImpl();
    }   

    static get ID(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('id','id','主键', new CnProjectContextCUImpl());
    }
    static get PROJECT_ID(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('project_id','projectId','项目主键', new CnProjectContextCUImpl());
    }
    static get GATEWAY(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('gateway','gateway','网关', new CnProjectContextCUImpl());
    }
    static get URI(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('uri','uri','URI', new CnProjectContextCUImpl());
    }
    static get DELETED(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('deleted','deleted','删除标记', new CnProjectContextCUImpl());
    }
    static get CREATE_USER_ID(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('create_user_id','createUserId','创建人', new CnProjectContextCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('create_time','createTime','创建时间', new CnProjectContextCUImpl());
    }
    static get ENV_ID(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('env_id','envId','环境ID', new CnProjectContextCUImpl());
    }
    static get ENV_CODE(): FieldUtil<CnProjectContextCU>{ 
        return new FieldUtil('env_code','envCode','TEST/PROD...', new CnProjectContextCUImpl());
    }
    static get CN_SLB_ID(): FieldInfo{  
        return new FieldInfo('cnSlbId','阿里云/华为云SLBID');
    }
    static get SLB_IP(): FieldInfo{  
        return new FieldInfo('slbIp','服务地址');
    }
    static get SLB_ADMIN_PORT(): FieldInfo{  
        return new FieldInfo('slbAdminPort','SLB映射管理端口号');
    }
    static get SLB_SERVICE_PORT(): FieldInfo{  
        return new FieldInfo('slbServicePort','SLB映射服务端口号');
    }

    get ID(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.ID;
    }
    get PROJECT_ID(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.PROJECT_ID;
    }
    get GATEWAY(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.GATEWAY;
    }
    get URI(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.URI;
    }
    get DELETED(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.DELETED;
    }
    get CREATE_USER_ID(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.CREATE_USER_ID;
    }
    get CREATE_TIME(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.CREATE_TIME;
    }
    get ENV_ID(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.ENV_ID;
    }
    get ENV_CODE(): FieldUtil<CnProjectContextCU>{ 
        return CnProjectContextMU.ENV_CODE;
    }
    get CN_SLB_ID(): FieldInfo{  
        return CnProjectContextMU.CN_SLB_ID;
    }
    get SLB_IP(): FieldInfo{  
        return CnProjectContextMU.SLB_IP;
    }
    get SLB_ADMIN_PORT(): FieldInfo{  
        return CnProjectContextMU.SLB_ADMIN_PORT;
    }
    get SLB_SERVICE_PORT(): FieldInfo{  
        return CnProjectContextMU.SLB_SERVICE_PORT;
    }
}
export {CnProjectContextMU, CnProjectContextCU}
