/*
 * This file is generated by jOOQ.
 */
package jj.tech.paolu.repository.jooq.tables;


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

import jj.tech.paolu.repository.jooq.Keys;
import jj.tech.paolu.repository.jooq.Yx;
import jj.tech.paolu.repository.jooq.tables.records.HistoryG24Record;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function8;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row8;
import org.jooq.Schema;
import org.jooq.SelectField;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })
public class HistoryG24 extends TableImpl<HistoryG24Record> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.history_g24</code>
     */
    public static final HistoryG24 HISTORY_G24 = new HistoryG24();

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

    /**
     * The column <code>yx.history_g24.id</code>.
     */
    public final TableField<HistoryG24Record, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.history_g24.newIssue</code>. 当前期号
     */
    public final TableField<HistoryG24Record, String> NEWISSUE = createField(DSL.name("newIssue"), SQLDataType.VARCHAR(20).nullable(false), this, "当前期号");

    /**
     * The column <code>yx.history_g24.issue</code>. 下一期号
     */
    public final TableField<HistoryG24Record, String> ISSUE = createField(DSL.name("issue"), SQLDataType.VARCHAR(20).nullable(false), this, "下一期号");

    /**
     * The column <code>yx.history_g24.ball</code>. 开奖号码
     */
    public final TableField<HistoryG24Record, String> BALL = createField(DSL.name("ball"), SQLDataType.VARCHAR(100).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "开奖号码");

    /**
     * The column <code>yx.history_g24.closeTime</code>. 关闭时间
     */
    public final TableField<HistoryG24Record, Integer> CLOSETIME = createField(DSL.name("closeTime"), SQLDataType.INTEGER.nullable(false), this, "关闭时间");

    /**
     * The column <code>yx.history_g24.openTime</code>. 开奖时间
     */
    public final TableField<HistoryG24Record, Integer> OPENTIME = createField(DSL.name("openTime"), SQLDataType.INTEGER.nullable(false), this, "开奖时间");

    /**
     * The column <code>yx.history_g24.addTime</code>. 提交时间
     */
    public final TableField<HistoryG24Record, LocalDateTime> ADDTIME = createField(DSL.name("addTime"), SQLDataType.LOCALDATETIME(0).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.LOCALDATETIME)), this, "提交时间");

    /**
     * The column <code>yx.history_g24.gameID</code>. 游戏ID
     */
    public final TableField<HistoryG24Record, String> GAMEID = createField(DSL.name("gameID"), SQLDataType.VARCHAR(20).defaultValue(DSL.field(DSL.raw("'24'"), SQLDataType.VARCHAR)), this, "游戏ID");

    private HistoryG24(Name alias, Table<HistoryG24Record> aliased) {
        this(alias, aliased, null);
    }

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

    /**
     * Create an aliased <code>yx.history_g24</code> table reference
     */
    public HistoryG24(String alias) {
        this(DSL.name(alias), HISTORY_G24);
    }

    /**
     * Create an aliased <code>yx.history_g24</code> table reference
     */
    public HistoryG24(Name alias) {
        this(alias, HISTORY_G24);
    }

    /**
     * Create a <code>yx.history_g24</code> table reference
     */
    public HistoryG24() {
        this(DSL.name("history_g24"), null);
    }

    public <O extends Record> HistoryG24(Table<O> child, ForeignKey<O, HistoryG24Record> key) {
        super(child, key, HISTORY_G24);
    }

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

    @Override
    public UniqueKey<HistoryG24Record> getPrimaryKey() {
        return Keys.KEY_HISTORY_G24_PRIMARY;
    }

    @Override
    public List<UniqueKey<HistoryG24Record>> getUniqueKeys() {
        return Arrays.asList(Keys.KEY_HISTORY_G24_NEWISSUE);
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row8 type methods
    // -------------------------------------------------------------------------

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

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function8<? super String, ? super String, ? super String, ? super String, ? super Integer, ? super Integer, ? 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, Function8<? super String, ? super String, ? super String, ? super String, ? super Integer, ? super Integer, ? super LocalDateTime, ? super String, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}
