/*
 * This file is generated by jOOQ.
 */
package ervu_dashboard.ervu_dashboard.db_beans.security.tables;


import ervu_dashboard.ervu_dashboard.db_beans.security.Keys;
import ervu_dashboard.ervu_dashboard.db_beans.security.Security;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.UserGroup.UserGroupPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.records.AccessLevelRecord;

import java.util.Arrays;
import java.util.Collection;
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.Path;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
import org.jooq.Record;
import org.jooq.SQL;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Stringly;
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;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>security.access_level</code>
     */
    public static final AccessLevel ACCESS_LEVEL = new AccessLevel();

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

    /**
     * The column <code>security.access_level.access_level_id</code>.
     */
    public final TableField<AccessLevelRecord, String> ACCESS_LEVEL_ID = createField(DSL.name("access_level_id"), SQLDataType.CHAR(36).nullable(false), this, "");

    /**
     * The column <code>security.access_level.level</code>.
     */
    public final TableField<AccessLevelRecord, Short> LEVEL = createField(DSL.name("level"), SQLDataType.SMALLINT.nullable(false), this, "");

    /**
     * The column <code>security.access_level.description</code>.
     */
    public final TableField<AccessLevelRecord, String> DESCRIPTION = createField(DSL.name("description"), SQLDataType.VARCHAR(256).nullable(false), this, "");

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

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

    /**
     * Create an aliased <code>security.access_level</code> table reference
     */
    public AccessLevel(String alias) {
        this(DSL.name(alias), ACCESS_LEVEL);
    }

    /**
     * Create an aliased <code>security.access_level</code> table reference
     */
    public AccessLevel(Name alias) {
        this(alias, ACCESS_LEVEL);
    }

    /**
     * Create a <code>security.access_level</code> table reference
     */
    public AccessLevel() {
        this(DSL.name("access_level"), null);
    }

    public <O extends Record> AccessLevel(Table<O> path, ForeignKey<O, AccessLevelRecord> childPath, InverseForeignKey<O, AccessLevelRecord> parentPath) {
        super(path, childPath, parentPath, ACCESS_LEVEL);
    }

    /**
     * A subtype implementing {@link Path} for simplified path-based joins.
     */
    public static class AccessLevelPath extends AccessLevel implements Path<AccessLevelRecord> {
        public <O extends Record> AccessLevelPath(Table<O> path, ForeignKey<O, AccessLevelRecord> childPath, InverseForeignKey<O, AccessLevelRecord> parentPath) {
            super(path, childPath, parentPath);
        }
        private AccessLevelPath(Name alias, Table<AccessLevelRecord> aliased) {
            super(alias, aliased);
        }

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

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

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

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

    @Override
    public UniqueKey<AccessLevelRecord> getPrimaryKey() {
        return Keys.PK_ACCESS_LEVEL;
    }

    @Override
    public List<UniqueKey<AccessLevelRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.UNI_ACCESS_LEVEL);
    }

    private transient UserGroupPath _userGroup;

    /**
     * Get the implicit to-many join path to the
     * <code>security.user_group</code> table
     */
    public UserGroupPath userGroup() {
        if (_userGroup == null)
            _userGroup = new UserGroupPath(this, null, Keys.USER_GROUP__FK_USER_GROUP_ACCESS_LEVEL.getInverseKey());

        return _userGroup;
    }

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

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

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

    /**
     * Rename this table
     */
    @Override
    public AccessLevel rename(String name) {
        return new AccessLevel(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public AccessLevel rename(Name name) {
        return new AccessLevel(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public AccessLevel rename(Table<?> name) {
        return new AccessLevel(name.getQualifiedName(), null);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public AccessLevel where(Condition condition) {
        return new AccessLevel(getQualifiedName(), aliased() ? this : null, null, condition);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public AccessLevel where(Collection<? extends Condition> conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public AccessLevel where(Condition... conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public AccessLevel where(Field<Boolean> condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public AccessLevel where(SQL condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public AccessLevel where(@Stringly.SQL String condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public AccessLevel where(@Stringly.SQL String condition, Object... binds) {
        return where(DSL.condition(condition, binds));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public AccessLevel where(@Stringly.SQL String condition, QueryPart... parts) {
        return where(DSL.condition(condition, parts));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public AccessLevel whereExists(Select<?> select) {
        return where(DSL.exists(select));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public AccessLevel whereNotExists(Select<?> select) {
        return where(DSL.notExists(select));
    }
}
