/*
 * This file is generated by jOOQ.
 */
package org.jooq.meta.duckdb.system.main.tables;


import java.util.Arrays;
import java.util.List;

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.InverseForeignKey;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
import org.jooq.meta.duckdb.system.main.Keys;
import org.jooq.meta.duckdb.system.main.Main;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>system.main.duckdb_columns</code>
     */
    public static final DuckdbColumns DUCKDB_COLUMNS = new DuckdbColumns();

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

    /**
     * The column <code>system.main.duckdb_columns.database_name</code>.
     */
    public final TableField<Record, String> DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>system.main.duckdb_columns.database_oid</code>.
     */
    public final TableField<Record, Long> DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>system.main.duckdb_columns.schema_name</code>.
     */
    public final TableField<Record, String> SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>system.main.duckdb_columns.schema_oid</code>.
     */
    public final TableField<Record, Long> SCHEMA_OID = createField(DSL.name("schema_oid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>system.main.duckdb_columns.table_name</code>.
     */
    public final TableField<Record, String> TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>system.main.duckdb_columns.table_oid</code>.
     */
    public final TableField<Record, Long> TABLE_OID = createField(DSL.name("table_oid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>system.main.duckdb_columns.column_name</code>.
     */
    public final TableField<Record, String> COLUMN_NAME = createField(DSL.name("column_name"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>system.main.duckdb_columns.column_index</code>.
     */
    public final TableField<Record, Integer> COLUMN_INDEX = createField(DSL.name("column_index"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>system.main.duckdb_columns.comment</code>.
     */
    public final TableField<Record, String> COMMENT = createField(DSL.name("comment"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>system.main.duckdb_columns.internal</code>.
     */
    public final TableField<Record, Boolean> INTERNAL = createField(DSL.name("internal"), SQLDataType.BOOLEAN, this, "");

    /**
     * The column <code>system.main.duckdb_columns.column_default</code>.
     */
    public final TableField<Record, String> COLUMN_DEFAULT = createField(DSL.name("column_default"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>system.main.duckdb_columns.is_nullable</code>.
     */
    public final TableField<Record, Boolean> IS_NULLABLE = createField(DSL.name("is_nullable"), SQLDataType.BOOLEAN, this, "");

    /**
     * The column <code>system.main.duckdb_columns.data_type</code>.
     */
    public final TableField<Record, String> DATA_TYPE = createField(DSL.name("data_type"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>system.main.duckdb_columns.data_type_id</code>.
     */
    public final TableField<Record, Long> DATA_TYPE_ID = createField(DSL.name("data_type_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>system.main.duckdb_columns.character_maximum_length</code>.
     */
    public final TableField<Record, Integer> CHARACTER_MAXIMUM_LENGTH = createField(DSL.name("character_maximum_length"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>system.main.duckdb_columns.numeric_precision</code>.
     */
    public final TableField<Record, Integer> NUMERIC_PRECISION = createField(DSL.name("numeric_precision"), SQLDataType.INTEGER, this, "");

    /**
     * The column
     * <code>system.main.duckdb_columns.numeric_precision_radix</code>.
     */
    public final TableField<Record, Integer> NUMERIC_PRECISION_RADIX = createField(DSL.name("numeric_precision_radix"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>system.main.duckdb_columns.numeric_scale</code>.
     */
    public final TableField<Record, Integer> NUMERIC_SCALE = createField(DSL.name("numeric_scale"), SQLDataType.INTEGER, this, "");

    private DuckdbColumns(Name alias, Table<Record> aliased) {
        this(alias, aliased, (Field<?>[]) null, null);
    }

    private DuckdbColumns(Name alias, Table<Record> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view(), where);
    }

    /**
     * Create an aliased <code>system.main.duckdb_columns</code> table reference
     */
    public DuckdbColumns(String alias) {
        this(DSL.name(alias), DUCKDB_COLUMNS);
    }

    /**
     * Create an aliased <code>system.main.duckdb_columns</code> table reference
     */
    public DuckdbColumns(Name alias) {
        this(alias, DUCKDB_COLUMNS);
    }

    /**
     * Create a <code>system.main.duckdb_columns</code> table reference
     */
    public DuckdbColumns() {
        this(DSL.name("duckdb_columns"), null);
    }

    public <O extends Record> DuckdbColumns(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
        super(path, childPath, parentPath, DUCKDB_COLUMNS);
    }

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

    @Override
    public List<ForeignKey<Record, ?>> getReferences() {
        return Arrays.asList(Keys.SYNTHETIC_FK_DUCKDB_COLUMNS__SYNTHETIC_PK_DUCKDB_TABLES, Keys.SYNTHETIC_FK_DUCKDB_COLUMNS__SYNTHETIC_PK_DUCKDB_TYPES);
    }

    private transient DuckdbTables _duckdbTables;

    /**
     * Get the implicit join path to the <code>system.main.duckdb_tables</code>
     * table.
     */
    public DuckdbTables duckdbTables() {
        if (_duckdbTables == null)
            _duckdbTables = new DuckdbTables(this, Keys.SYNTHETIC_FK_DUCKDB_COLUMNS__SYNTHETIC_PK_DUCKDB_TABLES, null);

        return _duckdbTables;
    }

    private transient DuckdbTypes _duckdbTypes;

    /**
     * Get the implicit join path to the <code>system.main.duckdb_types</code>
     * table.
     */
    public DuckdbTypes duckdbTypes() {
        if (_duckdbTypes == null)
            _duckdbTypes = new DuckdbTypes(this, Keys.SYNTHETIC_FK_DUCKDB_COLUMNS__SYNTHETIC_PK_DUCKDB_TYPES, null);

        return _duckdbTypes;
    }

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

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

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