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

import {PayConfigAccountMU} from './PayConfigAccount' 


/**
 * @author auto generate
 * @version 1.0
 * @date 2020-10-16 11:27
 */
interface PayConfigCU extends ConditionUtil<PayConfigCU>{
    ID:FieldUtil<PayConfigCU>;
    NAME:FieldUtil<PayConfigCU>;
    REMARK:FieldUtil<PayConfigCU>;
    STATE:FieldUtil<PayConfigCU>;
    CREATE_TIME:FieldUtil<PayConfigCU>;
    UPDATE_TIME:FieldUtil<PayConfigCU>;
}

class PayConfigCUImpl extends ConditionUtilImpl<PayConfigCUImpl> implements PayConfigCU{ 
    newInstance(): PayConfigCUImpl {
        return new PayConfigCUImpl();
    } 
    get ID(): FieldUtil<PayConfigCU>{  
        return new FieldUtil('ID','id','', this);
    }
    get NAME(): FieldUtil<PayConfigCU>{  
        return new FieldUtil('NAME','name','配置名称', this);
    }
    get REMARK(): FieldUtil<PayConfigCU>{  
        return new FieldUtil('REMARK','remark','备注', this);
    }
    get STATE(): FieldUtil<PayConfigCU>{  
        return new FieldUtil('STATE','state','状态：0-正常，1-删除', this);
    }
    get CREATE_TIME(): FieldUtil<PayConfigCU>{  
        return new FieldUtil('CREATE_TIME','createTime','创建时间', this);
    }
    get UPDATE_TIME(): FieldUtil<PayConfigCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', this);
    }
}

@Singleton 
class PayConfigMU extends TableUtilImpl<PayConfigCU,PayConfig>{ 
    tableName  = 'pay_config';
    tableFields  = ['id','name','remark','state','create_time','update_time'];
    modelFields  = ['id','name','remark','state','createTime','updateTime'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'payConfigAccount',
            parentIdFields: [PayConfigMU.ID],
            foreignKeyFields: [PayConfigAccountMU.PAY_CONFIG_ID],
            getTableUtil: ()=>{
                return Container.get(PayConfigAccountMU);
            }
        } as SubTable

];

    createConditionUtil(): PayConfigCU {
        return new PayConfigCUImpl();
    }   

    static get ID(): FieldUtil<PayConfigCU>{ 
        return new FieldUtil('ID','id','', new PayConfigCUImpl());
    }
    static get NAME(): FieldUtil<PayConfigCU>{ 
        return new FieldUtil('NAME','name','配置名称', new PayConfigCUImpl());
    }
    static get REMARK(): FieldUtil<PayConfigCU>{ 
        return new FieldUtil('REMARK','remark','备注', new PayConfigCUImpl());
    }
    static get STATE(): FieldUtil<PayConfigCU>{ 
        return new FieldUtil('STATE','state','状态：0-正常，1-删除', new PayConfigCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<PayConfigCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','创建时间', new PayConfigCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<PayConfigCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', new PayConfigCUImpl());
    }

    get ID(): FieldUtil<PayConfigCU>{ 
        return PayConfigMU.ID;
    }
    get NAME(): FieldUtil<PayConfigCU>{ 
        return PayConfigMU.NAME;
    }
    get REMARK(): FieldUtil<PayConfigCU>{ 
        return PayConfigMU.REMARK;
    }
    get STATE(): FieldUtil<PayConfigCU>{ 
        return PayConfigMU.STATE;
    }
    get CREATE_TIME(): FieldUtil<PayConfigCU>{ 
        return PayConfigMU.CREATE_TIME;
    }
    get UPDATE_TIME(): FieldUtil<PayConfigCU>{ 
        return PayConfigMU.UPDATE_TIME;
    }
}
export {PayConfigMU, PayConfigCU}
