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

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.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 TableDocument extends TableImpl<TableDocumentRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>databasir.table_document</code>
     */
    public static final TableDocument TABLE_DOCUMENT = new TableDocument();

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

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

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

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

    /**
     * The column <code>databasir.table_document.type</code>.
     */
    public final TableField<TableDocumentRecord, String> TYPE = createField(DSL.name("type"), SQLDataType.CLOB.nullable(false), this, "");

    /**
     * The column <code>databasir.table_document.comment</code>.
     */
    public final TableField<TableDocumentRecord, String> COMMENT = createField(DSL.name("comment"), SQLDataType.CLOB.nullable(false), this, "");

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

    private TableDocument(Name alias, Table<TableDocumentRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>databasir.table_document</code> table reference
     */
    public TableDocument(Name alias) {
        this(alias, TABLE_DOCUMENT);
    }

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

    public <O extends Record> TableDocument(Table<O> child, ForeignKey<O, TableDocumentRecord> key) {
        super(child, key, TABLE_DOCUMENT);
    }

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

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

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

    @Override
    public UniqueKey<TableDocumentRecord> getPrimaryKey() {
        return Keys.KEY_TABLE_DOCUMENT_PRIMARY;
    }

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

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

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

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

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

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