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

import {AdPositionStyleMU} from './AdPositionStyle' 


/**
 * @author auto generate
 * @version 1.1
 * @date 2021-06-07 15:15
 */
interface AdPositionCU extends ConditionUtil<AdPositionCU>{
    ID:FieldUtil<AdPositionCU>;
    NAME:FieldUtil<AdPositionCU>;
    TYPE:FieldUtil<AdPositionCU>;
    STATUS:FieldUtil<AdPositionCU>;
    CREATE_TIME:FieldUtil<AdPositionCU>;
    CREATOR:FieldUtil<AdPositionCU>;
    UPDATE_TIME:FieldUtil<AdPositionCU>;
    UPDATOR:FieldUtil<AdPositionCU>;
    DESCRIPTION:FieldUtil<AdPositionCU>;
    HAS_LOT:FieldUtil<AdPositionCU>;
}

class AdPositionCUImpl extends ConditionUtilImpl<AdPositionCUImpl> implements AdPositionCU{ 
    newInstance(): AdPositionCUImpl {
        return new AdPositionCUImpl();
    } 
    get ID(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('id','id','主键ID', this);
    }
    get NAME(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('name','name','广告位名称', this);
    }
    get TYPE(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('type','type','广告位类型：0，banner', this);
    }
    get STATUS(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('status','status','状态：0，启用；1，删除', this);
    }
    get CREATE_TIME(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('create_time','createTime','', this);
    }
    get CREATOR(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('creator','creator','创建者', this);
    }
    get UPDATE_TIME(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('update_time','updateTime','', this);
    }
    get UPDATOR(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('updator','updator','更新者', this);
    }
    get DESCRIPTION(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('description','description','描述', this);
    }
    get HAS_LOT(): FieldUtil<AdPositionCU>{  
        return new FieldUtil('has_lot','hasLot','是否有车场信息', this);
    }
}

@Singleton 
class AdPositionMU extends TableUtilImpl<AdPositionCU,AdPosition>{ 
    tableName  = 'ad_position';
    tableFields  = ['id','name','type','status','create_time','creator','update_time','updator','description','has_lot'];
    modelFields  = ['id','name','type','status','createTime','creator','updateTime','updator','description','hasLot'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'adPositionStyle',
            parentIdFields: [AdPositionMU.ID],
            foreignKeyFields: [AdPositionStyleMU.AD_POSITION_ID],
            getTableUtil: ()=>{
                return Container.get(AdPositionStyleMU);
            }
        } as SubTable

];

    createConditionUtil(): AdPositionCU {
        return new AdPositionCUImpl();
    }   

    static get ID(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('id','id','主键ID', new AdPositionCUImpl());
    }
    static get NAME(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('name','name','广告位名称', new AdPositionCUImpl());
    }
    static get TYPE(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('type','type','广告位类型：0，banner', new AdPositionCUImpl());
    }
    static get STATUS(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('status','status','状态：0，启用；1，删除', new AdPositionCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('create_time','createTime','', new AdPositionCUImpl());
    }
    static get CREATOR(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('creator','creator','创建者', new AdPositionCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('update_time','updateTime','', new AdPositionCUImpl());
    }
    static get UPDATOR(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('updator','updator','更新者', new AdPositionCUImpl());
    }
    static get DESCRIPTION(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('description','description','描述', new AdPositionCUImpl());
    }
    static get HAS_LOT(): FieldUtil<AdPositionCU>{ 
        return new FieldUtil('has_lot','hasLot','是否有车场信息', new AdPositionCUImpl());
    }

    get ID(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.ID;
    }
    get NAME(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.NAME;
    }
    get TYPE(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.TYPE;
    }
    get STATUS(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.STATUS;
    }
    get CREATE_TIME(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.CREATE_TIME;
    }
    get CREATOR(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.CREATOR;
    }
    get UPDATE_TIME(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.UPDATE_TIME;
    }
    get UPDATOR(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.UPDATOR;
    }
    get DESCRIPTION(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.DESCRIPTION;
    }
    get HAS_LOT(): FieldUtil<AdPositionCU>{ 
        return AdPositionMU.HAS_LOT;
    }
}
export {AdPositionMU, AdPositionCU}
