/*
 * 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 Systables extends TableImpl<Record> {

    private static final long serialVersionUID = 1L;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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_SYSTABLES__SYNTHETIC_PK_SYSSCHEMAS, null);

        return _sysschemas;
    }

    private transient Sysconglomerates _sysconglomerates;

    /**
     * Get the implicit to-many join path to the
     * <code>SYS.SYSCONGLOMERATES</code> table
     */
    public Sysconglomerates sysconglomerates() {
        if (_sysconglomerates == null)
            _sysconglomerates = new Sysconglomerates(this, null, Keys.SYNTHETIC_FK_SYSCONGLOMERATES__SYNTHETIC_PK_SYSTABLES.getInverseKey());

        return _sysconglomerates;
    }

    private transient Sysconstraints _sysconstraints;

    /**
     * Get the implicit to-many join path to the <code>SYS.SYSCONSTRAINTS</code>
     * table
     */
    public Sysconstraints sysconstraints() {
        if (_sysconstraints == null)
            _sysconstraints = new Sysconstraints(this, null, Keys.SYNTHETIC_FK_SYSCONSTRAINTS__SYNTHETIC_PK_SYSTABLES.getInverseKey());

        return _sysconstraints;
    }

    private transient Systriggers _systriggers;

    /**
     * Get the implicit to-many join path to the <code>SYS.SYSTRIGGERS</code>
     * table
     */
    public Systriggers systriggers() {
        if (_systriggers == null)
            _systriggers = new Systriggers(this, null, Keys.SYNTHETIC_FK_SYSTRIGGERS__SYNTHETIC_PK_SYSTABLES.getInverseKey());

        return _systriggers;
    }

    private transient Sysviews _sysviews;

    /**
     * Get the implicit to-many join path to the <code>SYS.SYSVIEWS</code> table
     */
    public Sysviews sysviews() {
        if (_sysviews == null)
            _sysviews = new Sysviews(this, null, Keys.SYNTHETIC_FK_SYSVIEWS__SYNTHETIC_PK_SYSTABLES.getInverseKey());

        return _sysviews;
    }

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

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

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