/*
 * 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.impl.DSL;
import org.jooq.impl.DefaultDataType;
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 Sysaliases extends TableImpl<Record> {

    private static final long serialVersionUID = 1L;

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

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

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

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

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

    /**
     * The column <code>SYS.SYSALIASES.JAVACLASSNAME</code>.
     */
    public final TableField<Record, String> JAVACLASSNAME = createField(DSL.name("JAVACLASSNAME"), SQLDataType.LONGVARCHAR.nullable(false), this, "");

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

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

    /**
     * The column <code>SYS.SYSALIASES.SYSTEMALIAS</code>.
     */
    public final TableField<Record, Boolean> SYSTEMALIAS = createField(DSL.name("SYSTEMALIAS"), SQLDataType.BOOLEAN.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> ALIASINFO = createField(DSL.name("ALIASINFO"), DefaultDataType.getDefaultDataType("\"org.apache.derby.catalog.AliasInfo\""), this, "");

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

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

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

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

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

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

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

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

    @Override
    public List<ForeignKey<Record, ?>> getReferences() {
        return Arrays.asList(Keys.SYNTHETIC_FK_SYSALIASES__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_SYSALIASES__SYNTHETIC_PK_SYSSCHEMAS, null);

        return _sysschemas;
    }

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

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

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