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

import {Ad_positionMU} from './Ad_position' 
import {Ad_styleMU} from './Ad_style' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-04-15 16:40
 */
interface Ad_position_styleCU extends ConditionUtil<Ad_position_styleCU>{
    AD_POSITION_ID:FieldUtil<Ad_position_styleCU>;
    AD_STYLE_ID:FieldUtil<Ad_position_styleCU>;
    DEL_FLAG:FieldUtil<Ad_position_styleCU>;
}

class Ad_position_styleCUImpl extends ConditionUtilImpl<Ad_position_styleCUImpl> implements Ad_position_styleCU{ 
    newInstance(): Ad_position_styleCUImpl {
        return new Ad_position_styleCUImpl();
    } 
    get AD_POSITION_ID(): FieldUtil<Ad_position_styleCU>{  
        return new FieldUtil('AD_POSITION_ID','adPositionId','广告位置表id', this);
    }
    get AD_STYLE_ID(): FieldUtil<Ad_position_styleCU>{  
        return new FieldUtil('AD_STYLE_ID','adStyleId','广告样式表id', this);
    }
    get DEL_FLAG(): FieldUtil<Ad_position_styleCU>{  
        return new FieldUtil('DEL_FLAG','delFlag','是否删除：0，否；1，是', this);
    }
}

@Singleton 
class Ad_position_styleMU extends TableUtilImpl<Ad_position_styleCU,Ad_position_style>{ 
    tableName  = 'ad_position_style';
    tableFields  = ['ad_position_id','ad_style_id','del_flag'];
    modelFields  = ['adPositionId','adStyleId','delFlag'];
    modelIdFields  = ['adPositionId','adStyleId'];
    tableIdFields  = ['ad_position_id','ad_style_id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'ad_position',
            parentIdFields: [Ad_position_styleMU.AD_POSITION_ID],
            foreignKeyFields: [Ad_positionMU.ID],
            getTableUtil: ()=>{
                return Container.get(Ad_positionMU);
            }
        } as SubTable

        ,{
            name: 'ad_style',
            parentIdFields: [Ad_position_styleMU.AD_STYLE_ID],
            foreignKeyFields: [Ad_styleMU.ID],
            getTableUtil: ()=>{
                return Container.get(Ad_styleMU);
            }
        } as SubTable

];

    createConditionUtil(): Ad_position_styleCU {
        return new Ad_position_styleCUImpl();
    }   

    static get AD_POSITION_ID(): FieldUtil<Ad_position_styleCU>{ 
        return new FieldUtil('AD_POSITION_ID','adPositionId','广告位置表id', new Ad_position_styleCUImpl());
    }
    static get AD_STYLE_ID(): FieldUtil<Ad_position_styleCU>{ 
        return new FieldUtil('AD_STYLE_ID','adStyleId','广告样式表id', new Ad_position_styleCUImpl());
    }
    static get DEL_FLAG(): FieldUtil<Ad_position_styleCU>{ 
        return new FieldUtil('DEL_FLAG','delFlag','是否删除：0，否；1，是', new Ad_position_styleCUImpl());
    }

    get AD_POSITION_ID(): FieldUtil<Ad_position_styleCU>{ 
        return Ad_position_styleMU.AD_POSITION_ID;
    }
    get AD_STYLE_ID(): FieldUtil<Ad_position_styleCU>{ 
        return Ad_position_styleMU.AD_STYLE_ID;
    }
    get DEL_FLAG(): FieldUtil<Ad_position_styleCU>{ 
        return Ad_position_styleMU.DEL_FLAG;
    }
}
export {Ad_position_styleMU, Ad_position_styleCU}
