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

import {ParkingLotMU} from './ParkingLot' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2020-10-16 11:27
 */
interface UserMonthlyCardCU extends ConditionUtil<UserMonthlyCardCU>{
    ID:FieldUtil<UserMonthlyCardCU>;
    USER_ID:FieldUtil<UserMonthlyCardCU>;
    CARD_ID:FieldUtil<UserMonthlyCardCU>;
    LOT_ID:FieldUtil<UserMonthlyCardCU>;
    CARD_TYPE:FieldUtil<UserMonthlyCardCU>;
    CAR_PLATE_NUM:FieldUtil<UserMonthlyCardCU>;
    VALID_FROM:FieldUtil<UserMonthlyCardCU>;
    VALID_TO:FieldUtil<UserMonthlyCardCU>;
    VALID_VALUE:FieldUtil<UserMonthlyCardCU>;
    CREATE_TIME:FieldUtil<UserMonthlyCardCU>;
    UPDATE_TIME:FieldUtil<UserMonthlyCardCU>;
    STATE:FieldUtil<UserMonthlyCardCU>;
}

class UserMonthlyCardCUImpl extends ConditionUtilImpl<UserMonthlyCardCUImpl> implements UserMonthlyCardCU{ 
    newInstance(): UserMonthlyCardCUImpl {
        return new UserMonthlyCardCUImpl();
    } 
    get ID(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('ID','id','唯一标识', this);
    }
    get USER_ID(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('USER_ID','userId','用户ID', this);
    }
    get CARD_ID(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('CARD_ID','cardId','月卡ID', this);
    }
    get LOT_ID(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('LOT_ID','lotId','停车场ID', this);
    }
    get CARD_TYPE(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('CARD_TYPE','cardType','卡片类型 0：临停车..云脑文档 1.6.2车牌类型枚举', this);
    }
    get CAR_PLATE_NUM(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('CAR_PLATE_NUM','carPlateNum','车牌号', this);
    }
    get VALID_FROM(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('VALID_FROM','validFrom','开始日期', this);
    }
    get VALID_TO(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('VALID_TO','validTo','结束日期', this);
    }
    get VALID_VALUE(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('VALID_VALUE','validValue','有效数值', this);
    }
    get CREATE_TIME(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('CREATE_TIME','createTime','创建时间', this);
    }
    get UPDATE_TIME(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', this);
    }
    get STATE(): FieldUtil<UserMonthlyCardCU>{  
        return new FieldUtil('STATE','state','状态：0-正常，1-删除', this);
    }
    get LOT_NAME(): FieldInfo{  
        return new FieldInfo('lotName','');
    }
}

@Singleton 
class UserMonthlyCardMU extends TableUtilImpl<UserMonthlyCardCU,UserMonthlyCard>{ 
    tableName  = 'user_monthly_card';
    tableFields  = ['ID','USER_ID','CARD_ID','LOT_ID','CARD_TYPE','CAR_PLATE_NUM','VALID_FROM','VALID_TO','VALID_VALUE','CREATE_TIME','UPDATE_TIME','state'];
    modelFields  = ['id','userId','cardId','lotId','cardType','carPlateNum','validFrom','validTo','validValue','createTime','updateTime','state','lotName'];
    modelIdFields  = ['id'];
    tableIdFields  = ['ID'];
    idType = IdType.CUSTOM;
    joinTables = [{
            joinByDefault: false,
            foreignKeyFields: [UserMonthlyCardMU.LOT_ID],
            joinIdFields: [ParkingLotMU.LOT_ID],
            getTableUtil: ()=>{
                return Container.get(ParkingLotMU);
            },
            fields: [
                {
                    fieldUtil: ParkingLotMU.LOT_NAME,
                    alias: 'lotName'
                }
            ]

        } as JoinTable

];
    subTables = [];

    createConditionUtil(): UserMonthlyCardCU {
        return new UserMonthlyCardCUImpl();
    }   

    static get ID(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('ID','id','唯一标识', new UserMonthlyCardCUImpl());
    }
    static get USER_ID(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('USER_ID','userId','用户ID', new UserMonthlyCardCUImpl());
    }
    static get CARD_ID(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('CARD_ID','cardId','月卡ID', new UserMonthlyCardCUImpl());
    }
    static get LOT_ID(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('LOT_ID','lotId','停车场ID', new UserMonthlyCardCUImpl());
    }
    static get CARD_TYPE(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('CARD_TYPE','cardType','卡片类型 0：临停车..云脑文档 1.6.2车牌类型枚举', new UserMonthlyCardCUImpl());
    }
    static get CAR_PLATE_NUM(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('CAR_PLATE_NUM','carPlateNum','车牌号', new UserMonthlyCardCUImpl());
    }
    static get VALID_FROM(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('VALID_FROM','validFrom','开始日期', new UserMonthlyCardCUImpl());
    }
    static get VALID_TO(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('VALID_TO','validTo','结束日期', new UserMonthlyCardCUImpl());
    }
    static get VALID_VALUE(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('VALID_VALUE','validValue','有效数值', new UserMonthlyCardCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','创建时间', new UserMonthlyCardCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', new UserMonthlyCardCUImpl());
    }
    static get STATE(): FieldUtil<UserMonthlyCardCU>{ 
        return new FieldUtil('STATE','state','状态：0-正常，1-删除', new UserMonthlyCardCUImpl());
    }
    static get LOT_NAME(): FieldInfo{  
        return new FieldInfo('lotName','');
    }

    get ID(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.ID;
    }
    get USER_ID(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.USER_ID;
    }
    get CARD_ID(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.CARD_ID;
    }
    get LOT_ID(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.LOT_ID;
    }
    get CARD_TYPE(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.CARD_TYPE;
    }
    get CAR_PLATE_NUM(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.CAR_PLATE_NUM;
    }
    get VALID_FROM(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.VALID_FROM;
    }
    get VALID_TO(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.VALID_TO;
    }
    get VALID_VALUE(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.VALID_VALUE;
    }
    get CREATE_TIME(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.UPDATE_TIME;
    }
    get STATE(): FieldUtil<UserMonthlyCardCU>{ 
        return UserMonthlyCardMU.STATE;
    }
    get LOT_NAME(): FieldInfo{  
        return UserMonthlyCardMU.LOT_NAME;
    }
}
export {UserMonthlyCardMU, UserMonthlyCardCU}
