/*
 * This file is generated by jOOQ.
 */
package ru.micord.ervu.account_applications.db_beans.public_.tables;


import java.sql.Timestamp;
import java.util.Collection;

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;

import ru.micord.ervu.account_applications.db_beans.public_.Keys;
import ru.micord.ervu.account_applications.db_beans.public_.Public;
import ru.micord.ervu.account_applications.db_beans.public_.tables.LinkUserApplicationUserApplicationRole.LinkUserApplicationUserApplicationRolePath;
import ru.micord.ervu.account_applications.db_beans.public_.tables.LinkUserApplicationUserApplicationUpdateRole.LinkUserApplicationUserApplicationUpdateRolePath;
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationList.UserApplicationListPath;
import ru.micord.ervu.account_applications.db_beans.public_.tables.records.UserApplicationRoleRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>public.user_application_role</code>
     */
    public static final UserApplicationRole USER_APPLICATION_ROLE = new UserApplicationRole();

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

    /**
     * The column <code>public.user_application_role.user_role_id</code>.
     * Уникальный идентификатор роли пользователя
     */
    public final TableField<UserApplicationRoleRecord, String> USER_ROLE_ID = createField(DSL.name("user_role_id"), SQLDataType.VARCHAR(36).nullable(false), this, "Уникальный идентификатор роли пользователя");

    /**
     * The column <code>public.user_application_role.role_name</code>. Название
     * роли пользователя
     */
    public final TableField<UserApplicationRoleRecord, String> ROLE_NAME = createField(DSL.name("role_name"), SQLDataType.VARCHAR(255).nullable(false), this, "Название роли пользователя");

    /**
     * The column <code>public.user_application_role.created</code>. Дата и
     * время создания записи
     */
    public final TableField<UserApplicationRoleRecord, Timestamp> CREATED = createField(DSL.name("created"), SQLDataType.TIMESTAMP(0).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "Дата и время создания записи");

    /**
     * The column <code>public.user_application_role.updated</code>. Дата и
     * время последнего обновления записи
     */
    public final TableField<UserApplicationRoleRecord, Timestamp> UPDATED = createField(DSL.name("updated"), SQLDataType.TIMESTAMP(0).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "Дата и время последнего обновления записи");

    /**
     * The column <code>public.user_application_role.role_code</code>. Код роли
     */
    public final TableField<UserApplicationRoleRecord, String> ROLE_CODE = createField(DSL.name("role_code"), SQLDataType.VARCHAR, this, "Код роли");

    /**
     * The column <code>public.user_application_role.admin_role</code>. Признак
     * роли администратора
     */
    public final TableField<UserApplicationRoleRecord, Boolean> ADMIN_ROLE = createField(DSL.name("admin_role"), SQLDataType.BOOLEAN, this, "Признак роли администратора");

    /**
     * The column <code>public.user_application_role.deleted</code>. Дата и
     * время окончания действия роли
     */
    public final TableField<UserApplicationRoleRecord, Timestamp> DELETED = createField(DSL.name("deleted"), SQLDataType.TIMESTAMP(0), this, "Дата и время окончания действия роли");

    /**
     * The column <code>public.user_application_role.active</code>.
     */
    public final TableField<UserApplicationRoleRecord, Boolean> ACTIVE = createField(DSL.name("active"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("true"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>public.user_application_role.version</code>.
     */
    public final TableField<UserApplicationRoleRecord, Integer> VERSION = createField(DSL.name("version"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");

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

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

    /**
     * Create an aliased <code>public.user_application_role</code> table
     * reference
     */
    public UserApplicationRole(String alias) {
        this(DSL.name(alias), USER_APPLICATION_ROLE);
    }

    /**
     * Create an aliased <code>public.user_application_role</code> table
     * reference
     */
    public UserApplicationRole(Name alias) {
        this(alias, USER_APPLICATION_ROLE);
    }

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

    public <O extends Record> UserApplicationRole(Table<O> path, ForeignKey<O, UserApplicationRoleRecord> childPath, InverseForeignKey<O, UserApplicationRoleRecord> parentPath) {
        super(path, childPath, parentPath, USER_APPLICATION_ROLE);
    }

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

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

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

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

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

    @Override
    public UniqueKey<UserApplicationRoleRecord> getPrimaryKey() {
        return Keys.USER_APPLICATION_ROLE_PKEY;
    }

    private transient LinkUserApplicationUserApplicationRolePath _linkUserApplicationUserApplicationRole;

    /**
     * Get the implicit to-many join path to the
     * <code>public.link_user_application_user_application_role</code> table
     */
    public LinkUserApplicationUserApplicationRolePath linkUserApplicationUserApplicationRole() {
        if (_linkUserApplicationUserApplicationRole == null)
            _linkUserApplicationUserApplicationRole = new LinkUserApplicationUserApplicationRolePath(this, null, Keys.LINK_USER_APPLICATION_USER_APPLICATION_ROLE__FK_USER_ROLE.getInverseKey());

        return _linkUserApplicationUserApplicationRole;
    }

    private transient LinkUserApplicationUserApplicationUpdateRolePath _linkUserApplicationUserApplicationUpdateRole;

    /**
     * Get the implicit to-many join path to the
     * <code>public.link_user_application_user_application_update_role</code>
     * table
     */
    public LinkUserApplicationUserApplicationUpdateRolePath linkUserApplicationUserApplicationUpdateRole() {
        if (_linkUserApplicationUserApplicationUpdateRole == null)
            _linkUserApplicationUserApplicationUpdateRole = new LinkUserApplicationUserApplicationUpdateRolePath(this, null, Keys.LINK_USER_APPLICATION_USER_APPLICATION_UPDATE_ROLE__FK1_USER_ROLE.getInverseKey());

        return _linkUserApplicationUserApplicationUpdateRole;
    }

    /**
     * Get the implicit many-to-many join path to the
     * <code>public.user_application_list</code> table, via the
     * <code>fk_user_application_list</code> key
     */
    public UserApplicationListPath fkUserApplicationList() {
        return linkUserApplicationUserApplicationRole().userApplicationList();
    }

    /**
     * Get the implicit many-to-many join path to the
     * <code>public.user_application_list</code> table, via the
     * <code>fk3_user_application_list</code> key
     */
    public UserApplicationListPath fk3UserApplicationList() {
        return linkUserApplicationUserApplicationUpdateRole().userApplicationList();
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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