/*
 * 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.AccessLevel.AccessLevelPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.LinkUserAccountUserGroup.LinkUserAccountUserGroupPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.LinkUserGroupUserRole.LinkUserGroupUserRolePath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.UserAccount.UserAccountPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.UserRole.UserRolePath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.records.UserGroupRecord;

import java.sql.Timestamp;
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 UserGroup extends TableImpl<UserGroupRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>security.user_group</code>
     */
    public static final UserGroup USER_GROUP = new UserGroup();

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

    /**
     * The column <code>security.user_group.user_group_id</code>.
     */
    public final TableField<UserGroupRecord, String> USER_GROUP_ID = createField(DSL.name("user_group_id"), SQLDataType.CHAR(36).nullable(false), this, "");

    /**
     * The column <code>security.user_group.name</code>.
     */
    public final TableField<UserGroupRecord, String> NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(255).nullable(false), this, "");

    /**
     * The column <code>security.user_group.created</code>.
     */
    public final TableField<UserGroupRecord, Timestamp> CREATED = createField(DSL.name("created"), SQLDataType.TIMESTAMP(0).nullable(false).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "");

    /**
     * The column <code>security.user_group.updated</code>.
     */
    public final TableField<UserGroupRecord, Timestamp> UPDATED = createField(DSL.name("updated"), SQLDataType.TIMESTAMP(0).nullable(false).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "");

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

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

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

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

    /**
     * Create an aliased <code>security.user_group</code> table reference
     */
    public UserGroup(Name alias) {
        this(alias, USER_GROUP);
    }

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

    public <O extends Record> UserGroup(Table<O> path, ForeignKey<O, UserGroupRecord> childPath, InverseForeignKey<O, UserGroupRecord> parentPath) {
        super(path, childPath, parentPath, USER_GROUP);
    }

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

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

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

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

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

    @Override
    public UniqueKey<UserGroupRecord> getPrimaryKey() {
        return Keys.PK_GROUP;
    }

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

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

    private transient AccessLevelPath _accessLevel;

    /**
     * Get the implicit join path to the <code>security.access_level</code>
     * table.
     */
    public AccessLevelPath accessLevel() {
        if (_accessLevel == null)
            _accessLevel = new AccessLevelPath(this, Keys.USER_GROUP__FK_USER_GROUP_ACCESS_LEVEL, null);

        return _accessLevel;
    }

    private transient LinkUserAccountUserGroupPath _linkUserAccountUserGroup;

    /**
     * Get the implicit to-many join path to the
     * <code>security.link_user_account_user_group</code> table
     */
    public LinkUserAccountUserGroupPath linkUserAccountUserGroup() {
        if (_linkUserAccountUserGroup == null)
            _linkUserAccountUserGroup = new LinkUserAccountUserGroupPath(this, null, Keys.LINK_USER_ACCOUNT_USER_GROUP__FK_USER_GROUP_GROUP.getInverseKey());

        return _linkUserAccountUserGroup;
    }

    private transient LinkUserGroupUserRolePath _linkUserGroupUserRole;

    /**
     * Get the implicit to-many join path to the
     * <code>security.link_user_group_user_role</code> table
     */
    public LinkUserGroupUserRolePath linkUserGroupUserRole() {
        if (_linkUserGroupUserRole == null)
            _linkUserGroupUserRole = new LinkUserGroupUserRolePath(this, null, Keys.LINK_USER_GROUP_USER_ROLE__FK_GROUP_ROLE_GROUP.getInverseKey());

        return _linkUserGroupUserRole;
    }

    /**
     * Get the implicit many-to-many join path to the
     * <code>security.user_account</code> table
     */
    public UserAccountPath userAccount() {
        return linkUserAccountUserGroup().userAccount();
    }

    /**
     * Get the implicit many-to-many join path to the
     * <code>security.user_role</code> table
     */
    public UserRolePath userRole() {
        return linkUserGroupUserRole().userRole();
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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