/*
 * 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.TableIndexDocumentRecord;

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.Row7;
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 TableIndexDocument extends TableImpl<TableIndexDocumentRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>databasir.table_index_document</code>
     */
    public static final TableIndexDocument TABLE_INDEX_DOCUMENT = new TableIndexDocument();

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

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

    /**
     * The column <code>databasir.table_index_document.table_document_id</code>.
     */
    public final TableField<TableIndexDocumentRecord, Integer> TABLE_DOCUMENT_ID = createField(DSL.name("table_document_id"), SQLDataType.INTEGER.nullable(false), this, "");

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

    /**
     * The column <code>databasir.table_index_document.name</code>.
     */
    public final TableField<TableIndexDocumentRecord, String> NAME = createField(DSL.name("name"), SQLDataType.CLOB.nullable(false), this, "");

    /**
     * The column <code>databasir.table_index_document.is_unique</code>.
     */
    public final TableField<TableIndexDocumentRecord, Boolean> IS_UNIQUE = createField(DSL.name("is_unique"), SQLDataType.BOOLEAN.nullable(false), this, "");

    /**
     * The column <code>databasir.table_index_document.column_name_array</code>.
     */
    public final TableField<TableIndexDocumentRecord, JSON> COLUMN_NAME_ARRAY = createField(DSL.name("column_name_array"), SQLDataType.JSON.nullable(false), this, "");

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

    private TableIndexDocument(Name alias, Table<TableIndexDocumentRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>databasir.table_index_document</code> table
     * reference
     */
    public TableIndexDocument(Name alias) {
        this(alias, TABLE_INDEX_DOCUMENT);
    }

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

    public <O extends Record> TableIndexDocument(Table<O> child, ForeignKey<O, TableIndexDocumentRecord> key) {
        super(child, key, TABLE_INDEX_DOCUMENT);
    }

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

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

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

    @Override
    public UniqueKey<TableIndexDocumentRecord> getPrimaryKey() {
        return Keys.KEY_TABLE_INDEX_DOCUMENT_PRIMARY;
    }

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

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

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

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

    // -------------------------------------------------------------------------
    // Row7 type methods
    // -------------------------------------------------------------------------

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