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

import {WbAdDeliveryProvMU} from './WbAdDeliveryProv' 


/**
 * @author auto generate
 * @version 1.2
 * @date 2020-12-29 15:31
 */
interface WbAdConfigCU extends ConditionUtil<WbAdConfigCU>{
    AD_ID:FieldUtil<WbAdConfigCU>;
    POSITION:FieldUtil<WbAdConfigCU>;
    CREATE_TIME:FieldUtil<WbAdConfigCU>;
    UPDATE_TIME:FieldUtil<WbAdConfigCU>;
    ID:FieldUtil<WbAdConfigCU>;
}

class WbAdConfigCUImpl extends ConditionUtilImpl<WbAdConfigCUImpl> implements WbAdConfigCU{ 
    newInstance(): WbAdConfigCUImpl {
        return new WbAdConfigCUImpl();
    } 
    get AD_ID(): FieldUtil<WbAdConfigCU>{  
        return new FieldUtil('AD_ID','adId','', this);
    }
    get POSITION(): FieldUtil<WbAdConfigCU>{  
        return new FieldUtil('POSITION','position','', this);
    }
    get CREATE_TIME(): FieldUtil<WbAdConfigCU>{  
        return new FieldUtil('CREATE_TIME','createTime','创建时间', this);
    }
    get UPDATE_TIME(): FieldUtil<WbAdConfigCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', this);
    }
    get ID(): FieldUtil<WbAdConfigCU>{  
        return new FieldUtil('ID','id','', this);
    }
}

@Singleton 
class WbAdConfigMU extends TableUtilImpl<WbAdConfigCU,WbAdConfig>{ 
    tableName  = 'wb_ad_config';
    tableFields  = ['AD_ID','POSITION','CREATE_TIME','UPDATE_TIME','ID'];
    modelFields  = ['adId','position','createTime','updateTime','id'];
    modelIdFields  = ['position','id'];
    tableIdFields  = ['POSITION','ID'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'wbAdDeliveryProv',
            parentIdFields: [WbAdConfigMU.ID],
            foreignKeyFields: [WbAdDeliveryProvMU.CONFIG_ID],
            getTableUtil: ()=>{
                return Container.get(WbAdDeliveryProvMU);
            }
        } as SubTable

];

    createConditionUtil(): WbAdConfigCU {
        return new WbAdConfigCUImpl();
    }   

    static get AD_ID(): FieldUtil<WbAdConfigCU>{ 
        return new FieldUtil('AD_ID','adId','', new WbAdConfigCUImpl());
    }
    static get POSITION(): FieldUtil<WbAdConfigCU>{ 
        return new FieldUtil('POSITION','position','', new WbAdConfigCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<WbAdConfigCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','创建时间', new WbAdConfigCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<WbAdConfigCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', new WbAdConfigCUImpl());
    }
    static get ID(): FieldUtil<WbAdConfigCU>{ 
        return new FieldUtil('ID','id','', new WbAdConfigCUImpl());
    }

    get AD_ID(): FieldUtil<WbAdConfigCU>{ 
        return WbAdConfigMU.AD_ID;
    }
    get POSITION(): FieldUtil<WbAdConfigCU>{ 
        return WbAdConfigMU.POSITION;
    }
    get CREATE_TIME(): FieldUtil<WbAdConfigCU>{ 
        return WbAdConfigMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<WbAdConfigCU>{ 
        return WbAdConfigMU.UPDATE_TIME;
    }
    get ID(): FieldUtil<WbAdConfigCU>{ 
        return WbAdConfigMU.ID;
    }
}
export {WbAdConfigMU, WbAdConfigCU}
