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


import java.sql.Date;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import org.jooq.Check;
import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
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.Internal;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;

import ru.micord.webbpm.ervu.business_metrics.db_beans.init_registration_info.InitRegistrationInfo;
import ru.micord.webbpm.ervu.business_metrics.db_beans.init_registration_info.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.init_registration_info.tables.records.ApplicationsReceivedFromEpguRecord;


/**
 * Первоначальная постановка на учет. Заявления, поступившие через ЕПГУ
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ApplicationsReceivedFromEpgu extends TableImpl<ApplicationsReceivedFromEpguRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>init_registration_info.applications_received_from_epgu</code>
     */
    public static final ApplicationsReceivedFromEpgu APPLICATIONS_RECEIVED_FROM_EPGU = new ApplicationsReceivedFromEpgu();

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

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.applications_received_from_epgu_id</code>.
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> APPLICATIONS_RECEIVED_FROM_EPGU_ID = createField(DSL.name("applications_received_from_epgu_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.update_date</code>.
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, 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>init_registration_info.applications_received_from_epgu.info_date</code>.
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Date> INFO_DATE = createField(DSL.name("info_date"), SQLDataType.DATE.nullable(false), this, "");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_all</code>.
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_ALL = createField(DSL.name("count_all"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_executor_appointed</code>.
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_EXECUTOR_APPOINTED = createField(DSL.name("count_executor_appointed"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_registered</code>.
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_REGISTERED = createField(DSL.name("count_registered"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_registration_refusal</code>.
     * Получен отказ в регистрации
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_REGISTRATION_REFUSAL = createField(DSL.name("count_registration_refusal"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Получен отказ в регистрации");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_refusal_provide_service</code>.
     * Получен отказ в предоставлении услуги по заявлению
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_REFUSAL_PROVIDE_SERVICE = createField(DSL.name("count_refusal_provide_service"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Получен отказ в предоставлении услуги по заявлению");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_executor_not_appointed_expired</code>.
     * Не назначен исполнитель свыше допустимых сроков (просрочено)
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_EXECUTOR_NOT_APPOINTED_EXPIRED = createField(DSL.name("count_executor_not_appointed_expired"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Не назначен исполнитель свыше допустимых сроков (просрочено)");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_executor_not_appointed_on_time</code>.
     * Не назначен исполнитель в пределах допустимых сроков
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_EXECUTOR_NOT_APPOINTED_ON_TIME = createField(DSL.name("count_executor_not_appointed_on_time"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Не назначен исполнитель в пределах допустимых сроков");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_received</code>.
     * Заявление получено ведомством
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_RECEIVED = createField(DSL.name("count_received"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Заявление получено ведомством");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.count_provided</code>.
     * Услуга по заявлению оказана
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, Long> COUNT_PROVIDED = createField(DSL.name("count_provided"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Услуга по заявлению оказана");

    /**
     * The column
     * <code>init_registration_info.applications_received_from_epgu.info_age</code>.
     */
    public final TableField<ApplicationsReceivedFromEpguRecord, String> INFO_AGE = createField(DSL.name("info_age"), SQLDataType.VARCHAR.nullable(false), this, "");

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

    private ApplicationsReceivedFromEpgu(Name alias, Table<ApplicationsReceivedFromEpguRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Первоначальная постановка на учет. Заявления, поступившие через ЕПГУ"), TableOptions.table(), where);
    }

    /**
     * Create an aliased
     * <code>init_registration_info.applications_received_from_epgu</code> table
     * reference
     */
    public ApplicationsReceivedFromEpgu(String alias) {
        this(DSL.name(alias), APPLICATIONS_RECEIVED_FROM_EPGU);
    }

    /**
     * Create an aliased
     * <code>init_registration_info.applications_received_from_epgu</code> table
     * reference
     */
    public ApplicationsReceivedFromEpgu(Name alias) {
        this(alias, APPLICATIONS_RECEIVED_FROM_EPGU);
    }

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

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

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

    @Override
    public UniqueKey<ApplicationsReceivedFromEpguRecord> getPrimaryKey() {
        return Keys.APPLICATIONS_RECEIVED_FROM_EPGU_PKEY;
    }

    @Override
    public List<Check<ApplicationsReceivedFromEpguRecord>> getChecks() {
        return Arrays.asList(
            Internal.createCheck(this, DSL.name("chk_info_age"), "(((info_age)::text = ANY (ARRAY[('17_YEARS'::character varying)::text, ('18_YEARS'::character varying)::text])))", true)
        );
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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