/*
 * This file is generated by jOOQ.
 */
package ervu_secret.ervu_secret.db_beans.information_schema.tables;


import ervu_secret.ervu_secret.db_beans.information_schema.Domains;
import ervu_secret.ervu_secret.db_beans.information_schema.InformationSchema;
import ervu_secret.ervu_secret.db_beans.information_schema.tables.records.AttributesRecord;

import java.util.Collection;

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
import org.jooq.SQL;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Stringly;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.impl.DSL;
import org.jooq.impl.TableImpl;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>information_schema.attributes</code>
     */
    public static final Attributes ATTRIBUTES = new Attributes();

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

    /**
     * The column <code>information_schema.attributes.udt_catalog</code>.
     */
    public final TableField<AttributesRecord, String> UDT_CATALOG = createField(DSL.name("udt_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.udt_schema</code>.
     */
    public final TableField<AttributesRecord, String> UDT_SCHEMA = createField(DSL.name("udt_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.udt_name</code>.
     */
    public final TableField<AttributesRecord, String> UDT_NAME = createField(DSL.name("udt_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.attribute_name</code>.
     */
    public final TableField<AttributesRecord, String> ATTRIBUTE_NAME = createField(DSL.name("attribute_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.ordinal_position</code>.
     */
    public final TableField<AttributesRecord, Integer> ORDINAL_POSITION = createField(DSL.name("ordinal_position"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.attribute_default</code>.
     */
    public final TableField<AttributesRecord, String> ATTRIBUTE_DEFAULT = createField(DSL.name("attribute_default"), Domains.CHARACTER_DATA.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.is_nullable</code>.
     */
    public final TableField<AttributesRecord, String> IS_NULLABLE = createField(DSL.name("is_nullable"), Domains.YES_OR_NO.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.data_type</code>.
     */
    public final TableField<AttributesRecord, String> DATA_TYPE = createField(DSL.name("data_type"), Domains.CHARACTER_DATA.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.character_maximum_length</code>.
     */
    public final TableField<AttributesRecord, Integer> CHARACTER_MAXIMUM_LENGTH = createField(DSL.name("character_maximum_length"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.character_octet_length</code>.
     */
    public final TableField<AttributesRecord, Integer> CHARACTER_OCTET_LENGTH = createField(DSL.name("character_octet_length"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.character_set_catalog</code>.
     */
    public final TableField<AttributesRecord, String> CHARACTER_SET_CATALOG = createField(DSL.name("character_set_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.character_set_schema</code>.
     */
    public final TableField<AttributesRecord, String> CHARACTER_SET_SCHEMA = createField(DSL.name("character_set_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.character_set_name</code>.
     */
    public final TableField<AttributesRecord, String> CHARACTER_SET_NAME = createField(DSL.name("character_set_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.collation_catalog</code>.
     */
    public final TableField<AttributesRecord, String> COLLATION_CATALOG = createField(DSL.name("collation_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.collation_schema</code>.
     */
    public final TableField<AttributesRecord, String> COLLATION_SCHEMA = createField(DSL.name("collation_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.collation_name</code>.
     */
    public final TableField<AttributesRecord, String> COLLATION_NAME = createField(DSL.name("collation_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.numeric_precision</code>.
     */
    public final TableField<AttributesRecord, Integer> NUMERIC_PRECISION = createField(DSL.name("numeric_precision"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.numeric_precision_radix</code>.
     */
    public final TableField<AttributesRecord, Integer> NUMERIC_PRECISION_RADIX = createField(DSL.name("numeric_precision_radix"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.numeric_scale</code>.
     */
    public final TableField<AttributesRecord, Integer> NUMERIC_SCALE = createField(DSL.name("numeric_scale"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.datetime_precision</code>.
     */
    public final TableField<AttributesRecord, Integer> DATETIME_PRECISION = createField(DSL.name("datetime_precision"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.interval_type</code>.
     */
    public final TableField<AttributesRecord, String> INTERVAL_TYPE = createField(DSL.name("interval_type"), Domains.CHARACTER_DATA.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.interval_precision</code>.
     */
    public final TableField<AttributesRecord, Integer> INTERVAL_PRECISION = createField(DSL.name("interval_precision"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.attribute_udt_catalog</code>.
     */
    public final TableField<AttributesRecord, String> ATTRIBUTE_UDT_CATALOG = createField(DSL.name("attribute_udt_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.attribute_udt_schema</code>.
     */
    public final TableField<AttributesRecord, String> ATTRIBUTE_UDT_SCHEMA = createField(DSL.name("attribute_udt_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.attribute_udt_name</code>.
     */
    public final TableField<AttributesRecord, String> ATTRIBUTE_UDT_NAME = createField(DSL.name("attribute_udt_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.scope_catalog</code>.
     */
    public final TableField<AttributesRecord, String> SCOPE_CATALOG = createField(DSL.name("scope_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.scope_schema</code>.
     */
    public final TableField<AttributesRecord, String> SCOPE_SCHEMA = createField(DSL.name("scope_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.scope_name</code>.
     */
    public final TableField<AttributesRecord, String> SCOPE_NAME = createField(DSL.name("scope_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.maximum_cardinality</code>.
     */
    public final TableField<AttributesRecord, Integer> MAXIMUM_CARDINALITY = createField(DSL.name("maximum_cardinality"), Domains.CARDINAL_NUMBER.getDataType(), this, "");

    /**
     * The column <code>information_schema.attributes.dtd_identifier</code>.
     */
    public final TableField<AttributesRecord, String> DTD_IDENTIFIER = createField(DSL.name("dtd_identifier"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.attributes.is_derived_reference_attribute</code>.
     */
    public final TableField<AttributesRecord, String> IS_DERIVED_REFERENCE_ATTRIBUTE = createField(DSL.name("is_derived_reference_attribute"), Domains.YES_OR_NO.getDataType(), this, "");

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

    private Attributes(Name alias, Table<AttributesRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "attributes" as  SELECT (current_database())::information_schema.sql_identifier AS udt_catalog,
          (nc.nspname)::information_schema.sql_identifier AS udt_schema,
          (c.relname)::information_schema.sql_identifier AS udt_name,
          (a.attname)::information_schema.sql_identifier AS attribute_name,
          (a.attnum)::information_schema.cardinal_number AS ordinal_position,
          (pg_get_expr(ad.adbin, ad.adrelid))::information_schema.character_data AS attribute_default,
          (
              CASE
                  WHEN (a.attnotnull OR ((t.typtype = 'd'::"char") AND t.typnotnull)) THEN 'NO'::text
                  ELSE 'YES'::text
              END)::information_schema.yes_or_no AS is_nullable,
          (
              CASE
                  WHEN ((t.typelem <> (0)::oid) AND (t.typlen = '-1'::integer)) THEN 'ARRAY'::text
                  WHEN (nt.nspname = 'pg_catalog'::name) THEN format_type(a.atttypid, NULL::integer)
                  ELSE 'USER-DEFINED'::text
              END)::information_schema.character_data AS data_type,
          (information_schema._pg_char_max_length(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS character_maximum_length,
          (information_schema._pg_char_octet_length(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS character_octet_length,
          (NULL::name)::information_schema.sql_identifier AS character_set_catalog,
          (NULL::name)::information_schema.sql_identifier AS character_set_schema,
          (NULL::name)::information_schema.sql_identifier AS character_set_name,
          (
              CASE
                  WHEN (nco.nspname IS NOT NULL) THEN current_database()
                  ELSE NULL::name
              END)::information_schema.sql_identifier AS collation_catalog,
          (nco.nspname)::information_schema.sql_identifier AS collation_schema,
          (co.collname)::information_schema.sql_identifier AS collation_name,
          (information_schema._pg_numeric_precision(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_precision,
          (information_schema._pg_numeric_precision_radix(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_precision_radix,
          (information_schema._pg_numeric_scale(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_scale,
          (information_schema._pg_datetime_precision(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS datetime_precision,
          (information_schema._pg_interval_type(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.character_data AS interval_type,
          (NULL::integer)::information_schema.cardinal_number AS interval_precision,
          (current_database())::information_schema.sql_identifier AS attribute_udt_catalog,
          (nt.nspname)::information_schema.sql_identifier AS attribute_udt_schema,
          (t.typname)::information_schema.sql_identifier AS attribute_udt_name,
          (NULL::name)::information_schema.sql_identifier AS scope_catalog,
          (NULL::name)::information_schema.sql_identifier AS scope_schema,
          (NULL::name)::information_schema.sql_identifier AS scope_name,
          (NULL::integer)::information_schema.cardinal_number AS maximum_cardinality,
          (a.attnum)::information_schema.sql_identifier AS dtd_identifier,
          ('NO'::character varying)::information_schema.yes_or_no AS is_derived_reference_attribute
         FROM ((((pg_attribute a
           LEFT JOIN pg_attrdef ad ON (((a.attrelid = ad.adrelid) AND (a.attnum = ad.adnum))))
           JOIN (pg_class c
           JOIN pg_namespace nc ON ((c.relnamespace = nc.oid))) ON ((a.attrelid = c.oid)))
           JOIN (pg_type t
           JOIN pg_namespace nt ON ((t.typnamespace = nt.oid))) ON ((a.atttypid = t.oid)))
           LEFT JOIN (pg_collation co
           JOIN pg_namespace nco ON ((co.collnamespace = nco.oid))) ON (((a.attcollation = co.oid) AND ((nco.nspname <> 'pg_catalog'::name) OR (co.collname <> 'default'::name)))))
        WHERE ((a.attnum > 0) AND (NOT a.attisdropped) AND (c.relkind = 'c'::"char") AND (pg_has_role(c.relowner, 'USAGE'::text) OR has_type_privilege(c.reltype, 'USAGE'::text)));
        """), where);
    }

    /**
     * Create an aliased <code>information_schema.attributes</code> table
     * reference
     */
    public Attributes(String alias) {
        this(DSL.name(alias), ATTRIBUTES);
    }

    /**
     * Create an aliased <code>information_schema.attributes</code> table
     * reference
     */
    public Attributes(Name alias) {
        this(alias, ATTRIBUTES);
    }

    /**
     * Create a <code>information_schema.attributes</code> table reference
     */
    public Attributes() {
        this(DSL.name("attributes"), null);
    }

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

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

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

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

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

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

    /**
     * Rename this table
     */
    @Override
    public Attributes rename(Table<?> name) {
        return new Attributes(name.getQualifiedName(), null);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public Attributes where(Condition condition) {
        return new Attributes(getQualifiedName(), aliased() ? this : null, null, condition);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public Attributes where(Collection<? extends Condition> conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public Attributes where(Condition... conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public Attributes where(Field<Boolean> condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public Attributes where(SQL condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public Attributes where(@Stringly.SQL String condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public Attributes where(@Stringly.SQL String condition, Object... binds) {
        return where(DSL.condition(condition, binds));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public Attributes where(@Stringly.SQL String condition, QueryPart... parts) {
        return where(DSL.condition(condition, parts));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public Attributes whereExists(Select<?> select) {
        return where(DSL.exists(select));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public Attributes whereNotExists(Select<?> select) {
        return where(DSL.notExists(select));
    }
}
