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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>information_schema.sequences</code>
     */
    public static final Sequences SEQUENCES = new Sequences();

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

    /**
     * The column <code>information_schema.sequences.sequence_catalog</code>.
     */
    public final TableField<Record, String> SEQUENCE_CATALOG = createField(DSL.name("sequence_catalog"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>information_schema.sequences.sequence_schema</code>.
     */
    public final TableField<Record, String> SEQUENCE_SCHEMA = createField(DSL.name("sequence_schema"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>information_schema.sequences.sequence_name</code>.
     */
    public final TableField<Record, String> SEQUENCE_NAME = createField(DSL.name("sequence_name"), SQLDataType.VARCHAR, this, "");

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

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

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

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

    /**
     * The column <code>information_schema.sequences.start_value</code>.
     */
    public final TableField<Record, String> START_VALUE = createField(DSL.name("start_value"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>information_schema.sequences.minimum_value</code>.
     */
    public final TableField<Record, String> MINIMUM_VALUE = createField(DSL.name("minimum_value"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>information_schema.sequences.maximum_value</code>.
     */
    public final TableField<Record, String> MAXIMUM_VALUE = createField(DSL.name("maximum_value"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>information_schema.sequences.increment</code>.
     */
    public final TableField<Record, String> INCREMENT = createField(DSL.name("increment"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>information_schema.sequences.cycle_option</code>.
     */
    public final TableField<Record, String> CYCLE_OPTION = createField(DSL.name("cycle_option"), SQLDataType.VARCHAR(3), this, "");

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

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

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

    /**
     * Create an aliased <code>information_schema.sequences</code> table
     * reference
     */
    public Sequences(Name alias) {
        this(alias, SEQUENCES);
    }

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

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

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

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

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

    private transient Schemata _schemata;

    /**
     * Get the implicit join path to the
     * <code>information_schema.schemata</code> table.
     */
    public Schemata schemata() {
        if (_schemata == null)
            _schemata = new Schemata(this, Keys.SEQUENCES__SYNTHETIC_FK_SEQUENCES__SYNTHETIC_PK_SCHEMATA, null);

        return _schemata;
    }

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

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

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