/*
 * This file is generated by jOOQ.
 */
package org.jooq.meta.derby.sys.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.derby.sys.Keys;
import org.jooq.meta.derby.sys.Sys;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>SYS.SYSCONSTRAINTS</code>
     */
    public static final Sysconstraints SYSCONSTRAINTS = new Sysconstraints();

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

    /**
     * The column <code>SYS.SYSCONSTRAINTS.CONSTRAINTID</code>.
     */
    public final TableField<Record, String> CONSTRAINTID = createField(DSL.name("CONSTRAINTID"), SQLDataType.CHAR(36).nullable(false), this, "");

    /**
     * The column <code>SYS.SYSCONSTRAINTS.TABLEID</code>.
     */
    public final TableField<Record, String> TABLEID = createField(DSL.name("TABLEID"), SQLDataType.CHAR(36).nullable(false), this, "");

    /**
     * The column <code>SYS.SYSCONSTRAINTS.CONSTRAINTNAME</code>.
     */
    public final TableField<Record, String> CONSTRAINTNAME = createField(DSL.name("CONSTRAINTNAME"), SQLDataType.VARCHAR(128).nullable(false), this, "");

    /**
     * The column <code>SYS.SYSCONSTRAINTS.TYPE</code>.
     */
    public final TableField<Record, String> TYPE = createField(DSL.name("TYPE"), SQLDataType.CHAR(1).nullable(false), this, "");

    /**
     * The column <code>SYS.SYSCONSTRAINTS.SCHEMAID</code>.
     */
    public final TableField<Record, String> SCHEMAID = createField(DSL.name("SCHEMAID"), SQLDataType.CHAR(36).nullable(false), this, "");

    /**
     * The column <code>SYS.SYSCONSTRAINTS.STATE</code>.
     */
    public final TableField<Record, String> STATE = createField(DSL.name("STATE"), SQLDataType.CHAR(1).nullable(false), this, "");

    /**
     * The column <code>SYS.SYSCONSTRAINTS.REFERENCECOUNT</code>.
     */
    public final TableField<Record, Integer> REFERENCECOUNT = createField(DSL.name("REFERENCECOUNT"), SQLDataType.INTEGER.nullable(false), this, "");

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

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

    /**
     * Create an aliased <code>SYS.SYSCONSTRAINTS</code> table reference
     */
    public Sysconstraints(String alias) {
        this(DSL.name(alias), SYSCONSTRAINTS);
    }

    /**
     * Create an aliased <code>SYS.SYSCONSTRAINTS</code> table reference
     */
    public Sysconstraints(Name alias) {
        this(alias, SYSCONSTRAINTS);
    }

    /**
     * Create a <code>SYS.SYSCONSTRAINTS</code> table reference
     */
    public Sysconstraints() {
        this(DSL.name("SYSCONSTRAINTS"), null);
    }

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

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

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

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

    private transient Sysschemas _sysschemas;

    /**
     * Get the implicit join path to the <code>SYS.SYSSCHEMAS</code> table.
     */
    public Sysschemas sysschemas() {
        if (_sysschemas == null)
            _sysschemas = new Sysschemas(this, Keys.SYNTHETIC_FK_SYSCONSTRAINTS__SYNTHETIC_PK_SYSSCHEMAS, null);

        return _sysschemas;
    }

    private transient Systables _systables;

    /**
     * Get the implicit join path to the <code>SYS.SYSTABLES</code> table.
     */
    public Systables systables() {
        if (_systables == null)
            _systables = new Systables(this, Keys.SYNTHETIC_FK_SYSCONSTRAINTS__SYNTHETIC_PK_SYSTABLES, null);

        return _systables;
    }

    private transient Syschecks _syschecks;

    /**
     * Get the implicit to-many join path to the <code>SYS.SYSCHECKS</code>
     * table
     */
    public Syschecks syschecks() {
        if (_syschecks == null)
            _syschecks = new Syschecks(this, null, Keys.SYNTHETIC_FK_SYSCHECKS__SYNTHETIC_PK_SYSCONSTRAINTS.getInverseKey());

        return _syschecks;
    }

    private transient Syskeys _syskeys;

    /**
     * Get the implicit to-many join path to the <code>SYS.SYSKEYS</code> table
     */
    public Syskeys syskeys() {
        if (_syskeys == null)
            _syskeys = new Syskeys(this, null, Keys.SYNTHETIC_FK_SYSKEYS__SYNTHETIC_PK_SYSCONSTRAINTS.getInverseKey());

        return _syskeys;
    }

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

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

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