/*
 * This file is generated by jOOQ.
 */
package com.databasir.dao.tables;


import com.databasir.dao.Databasir;
import com.databasir.dao.Indexes;
import com.databasir.dao.Keys;
import com.databasir.dao.tables.records.DatabaseDocumentHistoryRecord;

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

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.JSON;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row6;
import org.jooq.Schema;
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" })
public class DatabaseDocumentHistory extends TableImpl<DatabaseDocumentHistoryRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>databasir.database_document_history</code>
     */
    public static final DatabaseDocumentHistory DATABASE_DOCUMENT_HISTORY = new DatabaseDocumentHistory();

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

    /**
     * The column <code>databasir.database_document_history.id</code>.
     */
    public final TableField<DatabaseDocumentHistoryRecord, Integer> ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");

    /**
     * The column <code>databasir.database_document_history.project_id</code>.
     */
    public final TableField<DatabaseDocumentHistoryRecord, Integer> PROJECT_ID = createField(DSL.name("project_id"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column
     * <code>databasir.database_document_history.database_document_id</code>.
     */
    public final TableField<DatabaseDocumentHistoryRecord, Integer> DATABASE_DOCUMENT_ID = createField(DSL.name("database_document_id"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column
     * <code>databasir.database_document_history.database_document_object</code>.
     */
    public final TableField<DatabaseDocumentHistoryRecord, JSON> DATABASE_DOCUMENT_OBJECT = createField(DSL.name("database_document_object"), SQLDataType.JSON, this, "");

    /**
     * The column <code>databasir.database_document_history.version</code>.
     */
    public final TableField<DatabaseDocumentHistoryRecord, Long> VERSION = createField(DSL.name("version"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>databasir.database_document_history.create_at</code>.
     */
    public final TableField<DatabaseDocumentHistoryRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");

    private DatabaseDocumentHistory(Name alias, Table<DatabaseDocumentHistoryRecord> aliased) {
        this(alias, aliased, null);
    }

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

    /**
     * Create an aliased <code>databasir.database_document_history</code> table
     * reference
     */
    public DatabaseDocumentHistory(String alias) {
        this(DSL.name(alias), DATABASE_DOCUMENT_HISTORY);
    }

    /**
     * Create an aliased <code>databasir.database_document_history</code> table
     * reference
     */
    public DatabaseDocumentHistory(Name alias) {
        this(alias, DATABASE_DOCUMENT_HISTORY);
    }

    /**
     * Create a <code>databasir.database_document_history</code> table reference
     */
    public DatabaseDocumentHistory() {
        this(DSL.name("database_document_history"), null);
    }

    public <O extends Record> DatabaseDocumentHistory(Table<O> child, ForeignKey<O, DatabaseDocumentHistoryRecord> key) {
        super(child, key, DATABASE_DOCUMENT_HISTORY);
    }

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

    @Override
    public List<Index> getIndexes() {
        return Arrays.asList(Indexes.DATABASE_DOCUMENT_HISTORY_IDX_PROJECT_ID);
    }

    @Override
    public Identity<DatabaseDocumentHistoryRecord, Integer> getIdentity() {
        return (Identity<DatabaseDocumentHistoryRecord, Integer>) super.getIdentity();
    }

    @Override
    public UniqueKey<DatabaseDocumentHistoryRecord> getPrimaryKey() {
        return Keys.KEY_DATABASE_DOCUMENT_HISTORY_PRIMARY;
    }

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row6 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row6<Integer, Integer, Integer, JSON, Long, LocalDateTime> fieldsRow() {
        return (Row6) super.fieldsRow();
    }
}
