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

    private static final long serialVersionUID = 1L;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _systables;
    }

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

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

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