/*
 * 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.LinkUserRoleAuthority.LinkUserRoleAuthorityPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.UserRole.UserRolePath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.records.AuthorityRecord;

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 Authority extends TableImpl<AuthorityRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>security.authority</code>
     */
    public static final Authority AUTHORITY = new Authority();

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

    /**
     * The column <code>security.authority.authority_id</code>.
     */
    public final TableField<AuthorityRecord, String> AUTHORITY_ID = createField(DSL.name("authority_id"), SQLDataType.CHAR(36).nullable(false), this, "");

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

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

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

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

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

    /**
     * Create an aliased <code>security.authority</code> table reference
     */
    public Authority(Name alias) {
        this(alias, AUTHORITY);
    }

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

    public <O extends Record> Authority(Table<O> path, ForeignKey<O, AuthorityRecord> childPath, InverseForeignKey<O, AuthorityRecord> parentPath) {
        super(path, childPath, parentPath, AUTHORITY);
    }

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

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

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

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

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

    @Override
    public UniqueKey<AuthorityRecord> getPrimaryKey() {
        return Keys.PK_AUTHORITY;
    }

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

    private transient LinkUserRoleAuthorityPath _linkUserRoleAuthority;

    /**
     * Get the implicit to-many join path to the
     * <code>security.link_user_role_authority</code> table
     */
    public LinkUserRoleAuthorityPath linkUserRoleAuthority() {
        if (_linkUserRoleAuthority == null)
            _linkUserRoleAuthority = new LinkUserRoleAuthorityPath(this, null, Keys.LINK_USER_ROLE_AUTHORITY__FK_ROLE_AUTHORITY_AUTHORITY.getInverseKey());

        return _linkUserRoleAuthority;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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