/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list_subsystem.tables;


import java.sql.Date;
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.Identity;
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.webbpm.ervu.business_metrics.db_beans.metrics.tables.Recruitment.RecruitmentPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list_subsystem.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list_subsystem.SummonsesListSubsystem;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list_subsystem.tables.records.PersonalAccountsRecord;


/**
 * Реестр повесток подсистема. Личные кабинеты
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class PersonalAccounts extends TableImpl<PersonalAccountsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>summonses_list_subsystem.personal_accounts</code>
     */
    public static final PersonalAccounts PERSONAL_ACCOUNTS = new PersonalAccounts();

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

    /**
     * The column
     * <code>summonses_list_subsystem.personal_accounts.personal_accounts_id</code>.
     */
    public final TableField<PersonalAccountsRecord, Long> PERSONAL_ACCOUNTS_ID = createField(DSL.name("personal_accounts_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

    /**
     * The column
     * <code>summonses_list_subsystem.personal_accounts.recruitment_id</code>.
     */
    public final TableField<PersonalAccountsRecord, String> RECRUITMENT_ID = createField(DSL.name("recruitment_id"), SQLDataType.VARCHAR(36).nullable(false), this, "");

    /**
     * The column
     * <code>summonses_list_subsystem.personal_accounts.update_date</code>.
     */
    public final TableField<PersonalAccountsRecord, Timestamp> UPDATE_DATE = createField(DSL.name("update_date"), SQLDataType.TIMESTAMP(0).nullable(false).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "");

    /**
     * The column
     * <code>summonses_list_subsystem.personal_accounts.info_date</code>.
     */
    public final TableField<PersonalAccountsRecord, Date> INFO_DATE = createField(DSL.name("info_date"), SQLDataType.DATE.nullable(false), this, "");

    /**
     * The column
     * <code>summonses_list_subsystem.personal_accounts.count_registered</code>.
     * Состоящих на учете
     */
    public final TableField<PersonalAccountsRecord, Long> COUNT_REGISTERED = createField(DSL.name("count_registered"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Состоящих на учете");

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

    private PersonalAccounts(Name alias, Table<PersonalAccountsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Реестр повесток подсистема. Личные кабинеты"), TableOptions.table(), where);
    }

    /**
     * Create an aliased <code>summonses_list_subsystem.personal_accounts</code>
     * table reference
     */
    public PersonalAccounts(String alias) {
        this(DSL.name(alias), PERSONAL_ACCOUNTS);
    }

    /**
     * Create an aliased <code>summonses_list_subsystem.personal_accounts</code>
     * table reference
     */
    public PersonalAccounts(Name alias) {
        this(alias, PERSONAL_ACCOUNTS);
    }

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

    public <O extends Record> PersonalAccounts(Table<O> path, ForeignKey<O, PersonalAccountsRecord> childPath, InverseForeignKey<O, PersonalAccountsRecord> parentPath) {
        super(path, childPath, parentPath, PERSONAL_ACCOUNTS);
    }

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

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

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

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

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

    @Override
    public Identity<PersonalAccountsRecord, Long> getIdentity() {
        return (Identity<PersonalAccountsRecord, Long>) super.getIdentity();
    }

    @Override
    public UniqueKey<PersonalAccountsRecord> getPrimaryKey() {
        return Keys.PERSONAL_ACCOUNTS_PKEY;
    }

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

    private transient RecruitmentPath _recruitment;

    /**
     * Get the implicit join path to the <code>metrics.recruitment</code> table.
     */
    public RecruitmentPath recruitment() {
        if (_recruitment == null)
            _recruitment = new RecruitmentPath(this, Keys.PERSONAL_ACCOUNTS__FK_CRIMINAL_ADMINISTRATIVE_LIABILITY_RECRUITMENT_ID, null);

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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