import {ModelConditionUtil, ModelConditionUtilImpl, FieldUtil, TableUtilImpl, IdType, BasicFieldUtil, JoinTable, SubTable } from 'model-util'
import {Container, Singleton} from 'typescript-ioc' 
import * as Knex from 'knex' 

import {BMViewModel,BMViewModelMU} from './BMViewModel' 


/**
 * @author Keytop midend auto generate
 * @version 1.0
 * @date 2020-06-02 09:56
 */
interface BMVersion{
    /**
    * 应用ID
    * @type { string }
    */
    appId?: string;
    /**
    * 基础版本ID
    * @type { string }
    */
    basicVersionId?: string;
    /**
    * 模型项目ID
    * @type { string }
    */
    bmProjectId?: string;
    /**
    * 创建时间
    * @type { Date }
    */
    createTime?: Date;
    /**
    * 创建人ID
    * @type { string }
    */
    createUserId?: string;
    /**
    * 描述
    * @type { string }
    */
    description?: string;
    /**
    * Gradle包名
    * @type { string }
    */
    gradlePackageName?: string;
    /**
    * 主键
    * @type { string }
    */
    id?: string;
    /**
    * Java构建状态 0:成功,1失败,3待构建
    * @type { string }
    */
    javaBuildStatus?: string;
    /**
    * 主版本
    * @type { number }
    */
    major?: number;
    /**
    * 次版本
    * @type { number }
    */
    minor?: number;
    /**
    * NPM构建状态 0:成功,1失败,3待构建
    * @type { string }
    */
    npmBuildStatus?: string;
    /**
    * NPM包名
    * @type { string }
    */
    npmPackageName?: string;
    /**
    * 是否已发布的
    * @type { boolean }
    */
    released?: boolean;
    /**
    * 服务中心ID
    * @type { string }
    */
    serviceCenterId?: string;
    /**
    * 更新时间
    * @type { Date }
    */
    updateTime?: Date;
    /**
    * 修改人ID
    * @type { string }
    */
    updateUserId?: string;
    /**
    * 版本号
    * @type { string }
    */
    versionNo?: string;
    /**
    * 子表 BMViewModel 
    * @type { BMViewModel[] }
    */
    bMViewModel:BMViewModel[];
}
interface BMVersionMCU extends ModelConditionUtil<BMVersionMCU>{
    APP_ID:FieldUtil<BMVersionMCU>;
    BASIC_VERSION_ID:FieldUtil<BMVersionMCU>;
    BM_PROJECT_ID:FieldUtil<BMVersionMCU>;
    CREATE_TIME:FieldUtil<BMVersionMCU>;
    CREATE_USER_ID:FieldUtil<BMVersionMCU>;
    DESCRIPTION:FieldUtil<BMVersionMCU>;
    GRADLE_PACKAGE_NAME:FieldUtil<BMVersionMCU>;
    ID:FieldUtil<BMVersionMCU>;
    JAVA_BUILD_STATUS:FieldUtil<BMVersionMCU>;
    MAJOR:FieldUtil<BMVersionMCU>;
    MINOR:FieldUtil<BMVersionMCU>;
    NPM_BUILD_STATUS:FieldUtil<BMVersionMCU>;
    NPM_PACKAGE_NAME:FieldUtil<BMVersionMCU>;
    RELEASED:FieldUtil<BMVersionMCU>;
    SERVICE_CENTER_ID:FieldUtil<BMVersionMCU>;
    UPDATE_TIME:FieldUtil<BMVersionMCU>;
    UPDATE_USER_ID:FieldUtil<BMVersionMCU>;
    VERSION_NO:FieldUtil<BMVersionMCU>;
}

class BMVersionMCUImpl extends ModelConditionUtilImpl<BMVersionMCUImpl> implements BMVersionMCU{ 
    newInstance(): BMVersionMCUImpl {
        return new BMVersionMCUImpl();
    } 
    get APP_ID(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('APP_ID','appId','应用ID', this);
    }
    get BASIC_VERSION_ID(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('BASIC_VERSION_ID','basicVersionId','基础版本ID', this);
    }
    get BM_PROJECT_ID(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('BM_PROJECT_ID','bmProjectId','模型项目ID', this);
    }
    get CREATE_TIME(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('CREATE_TIME','createTime','创建时间', this);
    }
    get CREATE_USER_ID(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('CREATE_USER_ID','createUserId','创建人ID', this);
    }
    get DESCRIPTION(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('DESCRIPTION','description','描述', this);
    }
    get GRADLE_PACKAGE_NAME(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('GRADLE_PACKAGE_NAME','gradlePackageName','Gradle包名', this);
    }
    get ID(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('ID','id','主键', this);
    }
    get JAVA_BUILD_STATUS(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('JAVA_BUILD_STATUS','javaBuildStatus','Java构建状态 0:成功,1失败,3待构建', this);
    }
    get MAJOR(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('MAJOR','major','主版本', this);
    }
    get MINOR(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('MINOR','minor','次版本', this);
    }
    get NPM_BUILD_STATUS(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('NPM_BUILD_STATUS','npmBuildStatus','NPM构建状态 0:成功,1失败,3待构建', this);
    }
    get NPM_PACKAGE_NAME(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('NPM_PACKAGE_NAME','npmPackageName','NPM包名', this);
    }
    get RELEASED(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('RELEASED','released','是否已发布的', this);
    }
    get SERVICE_CENTER_ID(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('SERVICE_CENTER_ID','serviceCenterId','服务中心ID', this);
    }
    get UPDATE_TIME(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', this);
    }
    get UPDATE_USER_ID(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('UPDATE_USER_ID','updateUserId','修改人ID', this);
    }
    get VERSION_NO(): FieldUtil<BMVersionMCU>{  
        return new FieldUtil('VERSION_NO','versionNo','版本号', this);
    }
}

@Singleton 
class BMVersionMU extends TableUtilImpl<BMVersionMCU,BMVersion>{ 
    tableName  = 'bm_version';
    tableFields  = ['app_id','basic_version_id','bm_project_id','create_time','create_user_id','description','gradle_package_name','id','java_build_status','major','minor','npm_build_status','npm_package_name','released','service_center_id','update_time','update_user_id','version_no'];
    modelFields  = ['appId','basicVersionId','bmProjectId','createTime','createUserId','description','gradlePackageName','id','javaBuildStatus','major','minor','npmBuildStatus','npmPackageName','released','serviceCenterId','updateTime','updateUserId','versionNo'];
    modelIdFields  = ['id'];
    tableIdFields  = ['id'];
    idType = IdType.CUSTOM;
    joinTables = [];
    subTables = [{
            name: 'bMViewModel',
            parentIdFields: [BMVersionMU.ID],
            foreignKeyFields: [BMViewModelMU.ID],
            getTableUtil: ()=>{
                return Container.get(BMViewModelMU);
            }
        } as SubTable

];

    constructor() {
        super(Container.get(Knex));
    }
    createModelConditionUtil(): BMVersionMCU {
        return new BMVersionMCUImpl();
    }   

    static get APP_ID(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('APP_ID','appId','应用ID', new BMVersionMCUImpl());
    }
    static get BASIC_VERSION_ID(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('BASIC_VERSION_ID','basicVersionId','基础版本ID', new BMVersionMCUImpl());
    }
    static get BM_PROJECT_ID(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('BM_PROJECT_ID','bmProjectId','模型项目ID', new BMVersionMCUImpl());
    }
    static get CREATE_TIME(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('CREATE_TIME','createTime','创建时间', new BMVersionMCUImpl());
    }
    static get CREATE_USER_ID(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('CREATE_USER_ID','createUserId','创建人ID', new BMVersionMCUImpl());
    }
    static get DESCRIPTION(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('DESCRIPTION','description','描述', new BMVersionMCUImpl());
    }
    static get GRADLE_PACKAGE_NAME(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('GRADLE_PACKAGE_NAME','gradlePackageName','Gradle包名', new BMVersionMCUImpl());
    }
    static get ID(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('ID','id','主键', new BMVersionMCUImpl());
    }
    static get JAVA_BUILD_STATUS(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('JAVA_BUILD_STATUS','javaBuildStatus','Java构建状态 0:成功,1失败,3待构建', new BMVersionMCUImpl());
    }
    static get MAJOR(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('MAJOR','major','主版本', new BMVersionMCUImpl());
    }
    static get MINOR(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('MINOR','minor','次版本', new BMVersionMCUImpl());
    }
    static get NPM_BUILD_STATUS(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('NPM_BUILD_STATUS','npmBuildStatus','NPM构建状态 0:成功,1失败,3待构建', new BMVersionMCUImpl());
    }
    static get NPM_PACKAGE_NAME(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('NPM_PACKAGE_NAME','npmPackageName','NPM包名', new BMVersionMCUImpl());
    }
    static get RELEASED(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('RELEASED','released','是否已发布的', new BMVersionMCUImpl());
    }
    static get SERVICE_CENTER_ID(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('SERVICE_CENTER_ID','serviceCenterId','服务中心ID', new BMVersionMCUImpl());
    }
    static get UPDATE_TIME(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('UPDATE_TIME','updateTime','更新时间', new BMVersionMCUImpl());
    }
    static get UPDATE_USER_ID(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('UPDATE_USER_ID','updateUserId','修改人ID', new BMVersionMCUImpl());
    }
    static get VERSION_NO(): FieldUtil<BMVersionMCU>{ 
        return new FieldUtil('VERSION_NO','versionNo','版本号', new BMVersionMCUImpl());
    }

    get APP_ID(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.APP_ID;
    }
    get BASIC_VERSION_ID(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.BASIC_VERSION_ID;
    }
    get BM_PROJECT_ID(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.BM_PROJECT_ID;
    }
    get CREATE_TIME(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.CREATE_TIME;
    }
    get CREATE_USER_ID(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.CREATE_USER_ID;
    }
    get DESCRIPTION(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.DESCRIPTION;
    }
    get GRADLE_PACKAGE_NAME(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.GRADLE_PACKAGE_NAME;
    }
    get ID(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.ID;
    }
    get JAVA_BUILD_STATUS(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.JAVA_BUILD_STATUS;
    }
    get MAJOR(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.MAJOR;
    }
    get MINOR(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.MINOR;
    }
    get NPM_BUILD_STATUS(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.NPM_BUILD_STATUS;
    }
    get NPM_PACKAGE_NAME(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.NPM_PACKAGE_NAME;
    }
    get RELEASED(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.RELEASED;
    }
    get SERVICE_CENTER_ID(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.SERVICE_CENTER_ID;
    }
    get UPDATE_TIME(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.UPDATE_TIME;
    }
    get UPDATE_USER_ID(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.UPDATE_USER_ID;
    }
    get VERSION_NO(): FieldUtil<BMVersionMCU>{ 
        return BMVersionMU.VERSION_NO;
    }
}
export {BMVersionMCU, BMVersionMCUImpl, BMVersion, BMVersionMU}
