/*
 * This file is generated by jOOQ.
 */
package cn.vertxup.atom.domain.tables;


import cn.vertxup.atom.domain.Db;
import cn.vertxup.atom.domain.Keys;
import cn.vertxup.atom.domain.tables.records.MModelRecord;
import org.jooq.Record;
import org.jooq.*;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({"all", "unchecked", "rawtypes"})
public class MModel extends TableImpl<MModelRecord> {

    /**
     * The reference instance of <code>DB_ETERNAL.M_MODEL</code>
     */
    public static final MModel M_MODEL = new MModel();
    private static final long serialVersionUID = 1L;
    /**
     * The column <code>DB_ETERNAL.M_MODEL.KEY</code>. 「key」- 模型ID
     */
    public final TableField<MModelRecord, String> KEY = createField(DSL.name("KEY"), SQLDataType.VARCHAR(36).nullable(false), this, "「key」- 模型ID");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.IDENTIFIER</code>. 「identifier」-
     * 当前模型全局唯一ID
     */
    public final TableField<MModelRecord, String> IDENTIFIER = createField(DSL.name("IDENTIFIER"), SQLDataType.VARCHAR(255), this, "「identifier」- 当前模型全局唯一ID");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.NAMESPACE</code>. 「namespace」-
     * 当前模型使用的名空间
     */
    public final TableField<MModelRecord, String> NAMESPACE = createField(DSL.name("NAMESPACE"), SQLDataType.VARCHAR(255), this, "「namespace」- 当前模型使用的名空间");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.NAME</code>. 「name」- 当前模型的名称
     */
    public final TableField<MModelRecord, String> NAME = createField(DSL.name("NAME"), SQLDataType.VARCHAR(255), this, "「name」- 当前模型的名称");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.ALIAS</code>. 「alias」- 模型别名（业务名）
     */
    public final TableField<MModelRecord, String> ALIAS = createField(DSL.name("ALIAS"), SQLDataType.VARCHAR(255), this, "「alias」- 模型别名（业务名）");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.TYPE</code>. 「type」- 当前模型的类型信息
     */
    public final TableField<MModelRecord, String> TYPE = createField(DSL.name("TYPE"), SQLDataType.VARCHAR(10), this, "「type」- 当前模型的类型信息");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.COMMENTS</code>. 「comments」-
     * 当前模型的描述信息
     */
    public final TableField<MModelRecord, String> COMMENTS = createField(DSL.name("COMMENTS"), SQLDataType.CLOB, this, "「comments」- 当前模型的描述信息");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.CATEGORY_TREE</code>. 「categoryTree」-
     * 当前模型所属的类型树
     */
    public final TableField<MModelRecord, String> CATEGORY_TREE = createField(DSL.name("CATEGORY_TREE"), SQLDataType.VARCHAR(255), this, "「categoryTree」- 当前模型所属的类型树");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.CATEGORY_ID</code>. 「categoryId」-
     * 关联的类型的ID
     */
    public final TableField<MModelRecord, String> CATEGORY_ID = createField(DSL.name("CATEGORY_ID"), SQLDataType.VARCHAR(36), this, "「categoryId」- 关联的类型的ID");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.RULE_UNIQUE</code>. 「ruleUnique」-
     * 当前模型的标识规则
     */
    public final TableField<MModelRecord, String> RULE_UNIQUE = createField(DSL.name("RULE_UNIQUE"), SQLDataType.CLOB, this, "「ruleUnique」- 当前模型的标识规则");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.IS_TRACK</code>. 「isTrack」- 该组件为
     * track 表示执行 ACTIVITY 的变更监控功能（生成变更历史）
     */
    public final TableField<MModelRecord, Boolean> IS_TRACK = createField(DSL.name("IS_TRACK"), SQLDataType.BIT, this, "「isTrack」- 该组件为 track 表示执行 ACTIVITY 的变更监控功能（生成变更历史）");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.SPIDER</code>. 「spider」-
     * 主图格式，存储当前模型为起点的图层Json数据，每个模型只有一张
     */
    public final TableField<MModelRecord, String> SPIDER = createField(DSL.name("SPIDER"), SQLDataType.CLOB, this, "「spider」- 主图格式，存储当前模型为起点的图层Json数据，每个模型只有一张");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.SPIDER_COMPONENT</code>.
     * 「spiderComponent」- 在主图格式上存在的插件信息，用于处理主图格式的内容
     */
    public final TableField<MModelRecord, String> SPIDER_COMPONENT = createField(DSL.name("SPIDER_COMPONENT"), SQLDataType.VARCHAR(255), this, "「spiderComponent」- 在主图格式上存在的插件信息，用于处理主图格式的内容");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.SIGMA</code>. 「sigma」- 统一标识
     */
    public final TableField<MModelRecord, String> SIGMA = createField(DSL.name("SIGMA"), SQLDataType.VARCHAR(32), this, "「sigma」- 统一标识");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.LANGUAGE</code>. 「language」- 使用的语言
     */
    public final TableField<MModelRecord, String> LANGUAGE = createField(DSL.name("LANGUAGE"), SQLDataType.VARCHAR(10), this, "「language」- 使用的语言");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.ACTIVE</code>. 「active」- 是否启用
     */
    public final TableField<MModelRecord, Boolean> ACTIVE = createField(DSL.name("ACTIVE"), SQLDataType.BIT, this, "「active」- 是否启用");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.METADATA</code>. 「metadata」- 附加配置数据
     */
    public final TableField<MModelRecord, String> METADATA = createField(DSL.name("METADATA"), SQLDataType.CLOB, this, "「metadata」- 附加配置数据");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.CREATED_AT</code>. 「createdAt」- 创建时间
     */
    public final TableField<MModelRecord, LocalDateTime> CREATED_AT = createField(DSL.name("CREATED_AT"), SQLDataType.LOCALDATETIME(0), this, "「createdAt」- 创建时间");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.CREATED_BY</code>. 「createdBy」- 创建人
     */
    public final TableField<MModelRecord, String> CREATED_BY = createField(DSL.name("CREATED_BY"), SQLDataType.VARCHAR(36), this, "「createdBy」- 创建人");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.UPDATED_AT</code>. 「updatedAt」- 更新时间
     */
    public final TableField<MModelRecord, LocalDateTime> UPDATED_AT = createField(DSL.name("UPDATED_AT"), SQLDataType.LOCALDATETIME(0), this, "「updatedAt」- 更新时间");
    /**
     * The column <code>DB_ETERNAL.M_MODEL.UPDATED_BY</code>. 「updatedBy」- 更新人
     */
    public final TableField<MModelRecord, String> UPDATED_BY = createField(DSL.name("UPDATED_BY"), SQLDataType.VARCHAR(36), this, "「updatedBy」- 更新人");

    private MModel(Name alias, Table<MModelRecord> aliased) {
        this(alias, aliased, null);
    }

    private MModel(Name alias, Table<MModelRecord> aliased, Field<?>[] parameters) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
    }

    /**
     * Create an aliased <code>DB_ETERNAL.M_MODEL</code> table reference
     */
    public MModel(String alias) {
        this(DSL.name(alias), M_MODEL);
    }

    /**
     * Create an aliased <code>DB_ETERNAL.M_MODEL</code> table reference
     */
    public MModel(Name alias) {
        this(alias, M_MODEL);
    }

    /**
     * Create a <code>DB_ETERNAL.M_MODEL</code> table reference
     */
    public MModel() {
        this(DSL.name("M_MODEL"), null);
    }

    public <O extends Record> MModel(Table<O> child, ForeignKey<O, MModelRecord> key) {
        super(child, key, M_MODEL);
    }

    /**
     * The class holding records for this type
     */
    @Override
    public Class<MModelRecord> getRecordType() {
        return MModelRecord.class;
    }

    @Override
    public Schema getSchema() {
        return aliased() ? null : Db.DB_ETERNAL;
    }

    @Override
    public UniqueKey<MModelRecord> getPrimaryKey() {
        return Keys.KEY_M_MODEL_PRIMARY;
    }

    @Override
    public List<UniqueKey<MModelRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.KEY_M_MODEL_NAMESPACE, Keys.KEY_M_MODEL_NAMESPACE_2);
    }

    @Override
    public MModel as(String alias) {
        return new MModel(DSL.name(alias), this);
    }

    @Override
    public MModel as(Name alias) {
        return new MModel(alias, this);
    }

    @Override
    public MModel as(Table<?> alias) {
        return new MModel(alias.getQualifiedName(), this);
    }

    /**
     * Rename this table
     */
    @Override
    public MModel rename(String name) {
        return new MModel(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public MModel rename(Name name) {
        return new MModel(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public MModel rename(Table<?> name) {
        return new MModel(name.getQualifiedName(), null);
    }

    // -------------------------------------------------------------------------
    // Row21 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row21<String, String, String, String, String, String, String, String, String, String, Boolean, String, String, String, String, Boolean, String, LocalDateTime, String, LocalDateTime, String> fieldsRow() {
        return (Row21) super.fieldsRow();
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function21<? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super Boolean, ? super String, ? super String, ? super String, ? super String, ? super Boolean, ? super String, ? super LocalDateTime, ? super String, ? super LocalDateTime, ? super String, ? extends U> from) {
        return convertFrom(Records.mapping(from));
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Class,
     * Function)}.
     */
    public <U> SelectField<U> mapping(Class<U> toType, Function21<? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super Boolean, ? super String, ? super String, ? super String, ? super String, ? super Boolean, ? super String, ? super LocalDateTime, ? super String, ? super LocalDateTime, ? super String, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}
