/*
 * 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.EsiaUser.EsiaUserPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.LinkUserAccountUserGroup.LinkUserAccountUserGroupPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.OrgUnit.OrgUnitPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.UserAccountRefreshToken.UserAccountRefreshTokenPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.UserGroup.UserGroupPath;
import ervu_dashboard.ervu_dashboard.db_beans.security.tables.records.UserAccountRecord;

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 UserAccount extends TableImpl<UserAccountRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>security.user_account</code>
     */
    public static final UserAccount USER_ACCOUNT = new UserAccount();

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

    /**
     * The column <code>security.user_account.user_account_id</code>.
     */
    public final TableField<UserAccountRecord, String> USER_ACCOUNT_ID = createField(DSL.name("user_account_id"), SQLDataType.CHAR(36).nullable(false), this, "");

    /**
     * The column <code>security.user_account.email</code>.
     */
    public final TableField<UserAccountRecord, String> EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(150).nullable(false), this, "");

    /**
     * The column <code>security.user_account.first_name</code>.
     */
    public final TableField<UserAccountRecord, String> FIRST_NAME = createField(DSL.name("first_name"), SQLDataType.VARCHAR(100).nullable(false), this, "");

    /**
     * The column <code>security.user_account.last_name</code>.
     */
    public final TableField<UserAccountRecord, String> LAST_NAME = createField(DSL.name("last_name"), SQLDataType.VARCHAR(100).nullable(false), this, "");

    /**
     * The column <code>security.user_account.middle_name</code>.
     */
    public final TableField<UserAccountRecord, String> MIDDLE_NAME = createField(DSL.name("middle_name"), SQLDataType.VARCHAR(100), this, "");

    /**
     * The column <code>security.user_account.created</code>.
     */
    public final TableField<UserAccountRecord, 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_account.updated</code>.
     */
    public final TableField<UserAccountRecord, 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_account.locked</code>.
     */
    public final TableField<UserAccountRecord, Boolean> LOCKED = createField(DSL.name("locked"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>security.user_account.org_unit_id</code>.
     */
    public final TableField<UserAccountRecord, String> ORG_UNIT_ID = createField(DSL.name("org_unit_id"), SQLDataType.CHAR(36).nullable(false), this, "");

    /**
     * The column <code>security.user_account.username</code>.
     */
    public final TableField<UserAccountRecord, String> USERNAME = createField(DSL.name("username"), SQLDataType.VARCHAR(150).nullable(false), this, "");

    /**
     * The column <code>security.user_account.phone</code>.
     */
    public final TableField<UserAccountRecord, String> PHONE = createField(DSL.name("phone"), SQLDataType.VARCHAR(16), this, "");

    /**
     * The column <code>security.user_account.email_confirmed</code>.
     */
    public final TableField<UserAccountRecord, Boolean> EMAIL_CONFIRMED = createField(DSL.name("email_confirmed"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("true"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>security.user_account.user_source</code>.
     */
    public final TableField<UserAccountRecord, String> USER_SOURCE = createField(DSL.name("user_source"), SQLDataType.VARCHAR(20).nullable(false).defaultValue(DSL.field(DSL.raw("'LOCAL'::character varying"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>security.user_account.source_name</code>.
     */
    public final TableField<UserAccountRecord, String> SOURCE_NAME = createField(DSL.name("source_name"), SQLDataType.VARCHAR(20), this, "");

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

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

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

    /**
     * Create an aliased <code>security.user_account</code> table reference
     */
    public UserAccount(Name alias) {
        this(alias, USER_ACCOUNT);
    }

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

    public <O extends Record> UserAccount(Table<O> path, ForeignKey<O, UserAccountRecord> childPath, InverseForeignKey<O, UserAccountRecord> parentPath) {
        super(path, childPath, parentPath, USER_ACCOUNT);
    }

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

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

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

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

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

    @Override
    public UniqueKey<UserAccountRecord> getPrimaryKey() {
        return Keys.PK_USER;
    }

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

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

    private transient OrgUnitPath _orgUnit;

    /**
     * Get the implicit join path to the <code>security.org_unit</code> table.
     */
    public OrgUnitPath orgUnit() {
        if (_orgUnit == null)
            _orgUnit = new OrgUnitPath(this, Keys.USER_ACCOUNT__FK_USER_ORG_UNIT_ID, null);

        return _orgUnit;
    }

    private transient EsiaUserPath _esiaUser;

    /**
     * Get the implicit to-many join path to the <code>security.esia_user</code>
     * table
     */
    public EsiaUserPath esiaUser() {
        if (_esiaUser == null)
            _esiaUser = new EsiaUserPath(this, null, Keys.ESIA_USER__FK_ESIA_USER1.getInverseKey());

        return _esiaUser;
    }

    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_USER.getInverseKey());

        return _linkUserAccountUserGroup;
    }

    private transient UserAccountRefreshTokenPath _userAccountRefreshToken;

    /**
     * Get the implicit to-many join path to the
     * <code>security.user_account_refresh_token</code> table
     */
    public UserAccountRefreshTokenPath userAccountRefreshToken() {
        if (_userAccountRefreshToken == null)
            _userAccountRefreshToken = new UserAccountRefreshTokenPath(this, null, Keys.USER_ACCOUNT_REFRESH_TOKEN__FK_USER_ACCOUNT_REFRESH_TOKEN.getInverseKey());

        return _userAccountRefreshToken;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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