/*
 * This file is generated by jOOQ.
 */
package org.jooq.meta.postgres.pg_catalog.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.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.DefaultDataType;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
import org.jooq.meta.postgres.pg_catalog.Keys;
import org.jooq.meta.postgres.pg_catalog.PgCatalog;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>pg_catalog.pg_type</code>
     */
    public static final PgType PG_TYPE = new PgType();

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

    /**
     * The column <code>pg_catalog.pg_type.oid</code>.
     */
    public final TableField<Record, Long> OID = createField(DSL.name("oid"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typname</code>.
     */
    public final TableField<Record, String> TYPNAME = createField(DSL.name("typname"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typnamespace</code>.
     */
    public final TableField<Record, Long> TYPNAMESPACE = createField(DSL.name("typnamespace"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typowner</code>.
     */
    public final TableField<Record, Long> TYPOWNER = createField(DSL.name("typowner"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typlen</code>.
     */
    public final TableField<Record, Short> TYPLEN = createField(DSL.name("typlen"), SQLDataType.SMALLINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typbyval</code>.
     */
    public final TableField<Record, Boolean> TYPBYVAL = createField(DSL.name("typbyval"), SQLDataType.BOOLEAN.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typtype</code>.
     */
    public final TableField<Record, String> TYPTYPE = createField(DSL.name("typtype"), SQLDataType.CHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typcategory</code>.
     */
    public final TableField<Record, String> TYPCATEGORY = createField(DSL.name("typcategory"), SQLDataType.CHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typispreferred</code>.
     */
    public final TableField<Record, Boolean> TYPISPREFERRED = createField(DSL.name("typispreferred"), SQLDataType.BOOLEAN.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typisdefined</code>.
     */
    public final TableField<Record, Boolean> TYPISDEFINED = createField(DSL.name("typisdefined"), SQLDataType.BOOLEAN.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typdelim</code>.
     */
    public final TableField<Record, String> TYPDELIM = createField(DSL.name("typdelim"), SQLDataType.CHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typrelid</code>.
     */
    public final TableField<Record, Long> TYPRELID = createField(DSL.name("typrelid"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typsubscript</code>.
     */
    public final TableField<Record, String> TYPSUBSCRIPT = createField(DSL.name("typsubscript"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typelem</code>.
     */
    public final TableField<Record, Long> TYPELEM = createField(DSL.name("typelem"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typarray</code>.
     */
    public final TableField<Record, Long> TYPARRAY = createField(DSL.name("typarray"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typinput</code>.
     */
    public final TableField<Record, String> TYPINPUT = createField(DSL.name("typinput"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typoutput</code>.
     */
    public final TableField<Record, String> TYPOUTPUT = createField(DSL.name("typoutput"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typreceive</code>.
     */
    public final TableField<Record, String> TYPRECEIVE = createField(DSL.name("typreceive"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typsend</code>.
     */
    public final TableField<Record, String> TYPSEND = createField(DSL.name("typsend"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typmodin</code>.
     */
    public final TableField<Record, String> TYPMODIN = createField(DSL.name("typmodin"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typmodout</code>.
     */
    public final TableField<Record, String> TYPMODOUT = createField(DSL.name("typmodout"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typanalyze</code>.
     */
    public final TableField<Record, String> TYPANALYZE = createField(DSL.name("typanalyze"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typalign</code>.
     */
    public final TableField<Record, String> TYPALIGN = createField(DSL.name("typalign"), SQLDataType.CHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typstorage</code>.
     */
    public final TableField<Record, String> TYPSTORAGE = createField(DSL.name("typstorage"), SQLDataType.CHAR.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typnotnull</code>.
     */
    public final TableField<Record, Boolean> TYPNOTNULL = createField(DSL.name("typnotnull"), SQLDataType.BOOLEAN.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typbasetype</code>.
     */
    public final TableField<Record, Long> TYPBASETYPE = createField(DSL.name("typbasetype"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typtypmod</code>.
     */
    public final TableField<Record, Integer> TYPTYPMOD = createField(DSL.name("typtypmod"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typndims</code>.
     */
    public final TableField<Record, Integer> TYPNDIMS = createField(DSL.name("typndims"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typcollation</code>.
     */
    public final TableField<Record, Long> TYPCOLLATION = createField(DSL.name("typcollation"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * @deprecated Unknown data type. If this is a qualified, user-defined type,
     * it may have been excluded from code generation. If this is a built-in
     * type, you can define an explicit {@link org.jooq.Binding} to specify how
     * this type should be handled. Deprecation can be turned off using
     * {@literal <deprecationOnUnknownTypes/>} in your code generator
     * configuration.
     */
    @Deprecated
    public final TableField<Record, Object> TYPDEFAULTBIN = createField(DSL.name("typdefaultbin"), DefaultDataType.getDefaultDataType("\"pg_catalog\".\"pg_node_tree\""), this, "");

    /**
     * The column <code>pg_catalog.pg_type.typdefault</code>.
     */
    public final TableField<Record, String> TYPDEFAULT = createField(DSL.name("typdefault"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_type.typacl</code>.
     */
    public final TableField<Record, String[]> TYPACL = createField(DSL.name("typacl"), SQLDataType.VARCHAR.array(), this, "");

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

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

    /**
     * Create an aliased <code>pg_catalog.pg_type</code> table reference
     */
    public PgType(String alias) {
        this(DSL.name(alias), PG_TYPE);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_type</code> table reference
     */
    public PgType(Name alias) {
        this(alias, PG_TYPE);
    }

    /**
     * Create a <code>pg_catalog.pg_type</code> table reference
     */
    public PgType() {
        this(DSL.name("pg_type"), null);
    }

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

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

    @Override
    public UniqueKey<Record> getPrimaryKey() {
        return Keys.SYNTHETIC_PK_PG_TYPE;
    }

    @Override
    public List<UniqueKey<Record>> getUniqueKeys() {
        return Arrays.asList(Keys.PG_TYPE_OID_INDEX, Keys.PG_TYPE_TYPNAME_NSP_INDEX);
    }

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

    private transient PgNamespace _pgNamespace;

    /**
     * Get the implicit join path to the <code>pg_catalog.pg_namespace</code>
     * table.
     */
    public PgNamespace pgNamespace() {
        if (_pgNamespace == null)
            _pgNamespace = new PgNamespace(this, Keys.PG_TYPE__SYNTHETIC_FK_PG_TYPE__SYNTHETIC_PK_PG_NAMESPACE, null);

        return _pgNamespace;
    }

    private transient PgAttribute _pgAttribute;

    /**
     * Get the implicit to-many join path to the
     * <code>pg_catalog.pg_attribute</code> table
     */
    public PgAttribute pgAttribute() {
        if (_pgAttribute == null)
            _pgAttribute = new PgAttribute(this, null, Keys.PG_ATTRIBUTE__SYNTHETIC_FK_PG_ATTRIBUTE__SYNTHETIC_PK_PG_TYPE.getInverseKey());

        return _pgAttribute;
    }

    private transient PgEnum _pgEnum;

    /**
     * Get the implicit to-many join path to the <code>pg_catalog.pg_enum</code>
     * table
     */
    public PgEnum pgEnum() {
        if (_pgEnum == null)
            _pgEnum = new PgEnum(this, null, Keys.PG_ENUM__SYNTHETIC_FK_PG_ENUM__SYNTHETIC_PK_PG_TYPE.getInverseKey());

        return _pgEnum;
    }

    private transient PgProc _pgProc;

    /**
     * Get the implicit to-many join path to the <code>pg_catalog.pg_proc</code>
     * table
     */
    public PgProc pgProc() {
        if (_pgProc == null)
            _pgProc = new PgProc(this, null, Keys.PG_PROC__SYNTHETIC_FK_PG_PROC__SYNTHETIC_PK_PG_TYPE.getInverseKey());

        return _pgProc;
    }

    private transient PgSequence _pgSequence;

    /**
     * Get the implicit to-many join path to the
     * <code>pg_catalog.pg_sequence</code> table
     */
    public PgSequence pgSequence() {
        if (_pgSequence == null)
            _pgSequence = new PgSequence(this, null, Keys.PG_SEQUENCE__SYNTHETIC_FK_PG_SEQUENCE__SYNTHETIC_PK_PG_TYPE.getInverseKey());

        return _pgSequence;
    }

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

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

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