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

import {AdStyleMaterialTypeMU} from './AdStyleMaterialType' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2021-05-12 14:57
 */
interface AdStyleCU extends ConditionUtil<AdStyleCU>{
    ID:FieldUtil<AdStyleCU>;
    WIDTH:FieldUtil<AdStyleCU>;
    HEIGHT:FieldUtil<AdStyleCU>;
    STATUS:FieldUtil<AdStyleCU>;
    CREATE_TIME:FieldUtil<AdStyleCU>;
    CREATOR:FieldUtil<AdStyleCU>;
    UPDATE_TIME:FieldUtil<AdStyleCU>;
    UPDATOR:FieldUtil<AdStyleCU>;
    AD_POSITION_TYPE:FieldUtil<AdStyleCU>;
    NAME:FieldUtil<AdStyleCU>;
}

class AdStyleCUImpl extends ConditionUtilImpl<AdStyleCUImpl> implements AdStyleCU{ 
    newInstance(): AdStyleCUImpl {
        return new AdStyleCUImpl();
    } 
    get ID(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('id','id','主键id', this);
    }
    get WIDTH(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('width','width','宽度（单位像素）', this);
    }
    get HEIGHT(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('height','height','高度（单位像素）', this);
    }
    get STATUS(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('status','status','状态：0，启用；1，删除', this);
    }
    get CREATE_TIME(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('create_time','createTime','', this);
    }
    get CREATOR(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('creator','creator','', this);
    }
    get UPDATE_TIME(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('update_time','updateTime','', this);
    }
    get UPDATOR(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('updator','updator','', this);
    }
    get AD_POSITION_TYPE(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('ad_position_type','adPositionType','广告位类型：1，banner', this);
    }
    get NAME(): FieldUtil<AdStyleCU>{  
        return new FieldUtil('name','name','样式名称', this);
    }
}

@Singleton 
class AdStyleMU extends TableUtilImpl<AdStyleCU,AdStyle>{ 
    tableName  = 'ad_style';
    tableFields  = ['id','width','height','status','create_time','creator','update_time','updator','ad_position_type','name'];
    modelFields  = ['id','width','height','status','createTime','creator','updateTime','updator','adPositionType','name'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'adStyleMaterialType',
            parentIdFields: [AdStyleMU.ID],
            foreignKeyFields: [AdStyleMaterialTypeMU.AD_STYLE_ID],
            getTableUtil: ()=>{
                return Container.get(AdStyleMaterialTypeMU);
            }
        } as SubTable

];

    createConditionUtil(): AdStyleCU {
        return new AdStyleCUImpl();
    }   

    static get ID(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('id','id','主键id', new AdStyleCUImpl());
    }
    static get WIDTH(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('width','width','宽度（单位像素）', new AdStyleCUImpl());
    }
    static get HEIGHT(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('height','height','高度（单位像素）', new AdStyleCUImpl());
    }
    static get STATUS(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('status','status','状态：0，启用；1，删除', new AdStyleCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('create_time','createTime','', new AdStyleCUImpl());
    }
    static get CREATOR(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('creator','creator','', new AdStyleCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('update_time','updateTime','', new AdStyleCUImpl());
    }
    static get UPDATOR(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('updator','updator','', new AdStyleCUImpl());
    }
    static get AD_POSITION_TYPE(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('ad_position_type','adPositionType','广告位类型：1，banner', new AdStyleCUImpl());
    }
    static get NAME(): FieldUtil<AdStyleCU>{ 
        return new FieldUtil('name','name','样式名称', new AdStyleCUImpl());
    }

    get ID(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.ID;
    }
    get WIDTH(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.WIDTH;
    }
    get HEIGHT(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.HEIGHT;
    }
    get STATUS(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.STATUS;
    }
    get CREATE_TIME(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.CREATE_TIME;
    }
    get CREATOR(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.CREATOR;
    }
    get UPDATE_TIME(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.UPDATE_TIME;
    }
    get UPDATOR(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.UPDATOR;
    }
    get AD_POSITION_TYPE(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.AD_POSITION_TYPE;
    }
    get NAME(): FieldUtil<AdStyleCU>{ 
        return AdStyleMU.NAME;
    }
}
export {AdStyleMU, AdStyleCU}
