/*
 * 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.DecisionFormationStatusRecord;


/**
 * Первоначальная постановка на учет. Статус формирования решений
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DecisionFormationStatus extends TableImpl<DecisionFormationStatusRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>init_registration_info.decision_formation_status</code>
     */
    public static final DecisionFormationStatus DECISION_FORMATION_STATUS = new DecisionFormationStatus();

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

    /**
     * The column
     * <code>init_registration_info.decision_formation_status.decision_formation_status_id</code>.
     */
    public final TableField<DecisionFormationStatusRecord, Long> DECISION_FORMATION_STATUS_ID = createField(DSL.name("decision_formation_status_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>init_registration_info.decision_formation_status.info_source</code>.
     * информация об источнике  - PERSONAL_VISIT, GIR_VU,  EPGU
     */
    public final TableField<DecisionFormationStatusRecord, String> INFO_SOURCE = createField(DSL.name("info_source"), SQLDataType.VARCHAR.nullable(false), this, "информация об источнике  - PERSONAL_VISIT, GIR_VU,  EPGU");

    /**
     * The column
     * <code>init_registration_info.decision_formation_status.info_age</code>.
     * Информациия о каком возрасте 17_YEARS, 18_YEARS
     */
    public final TableField<DecisionFormationStatusRecord, String> INFO_AGE = createField(DSL.name("info_age"), SQLDataType.VARCHAR.nullable(false), this, "Информациия о каком возрасте 17_YEARS, 18_YEARS");

    /**
     * The column
     * <code>init_registration_info.decision_formation_status.count_signed</code>.
     */
    public final TableField<DecisionFormationStatusRecord, Long> COUNT_SIGNED = createField(DSL.name("count_signed"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>init_registration_info.decision_formation_status.count_suggested</code>.
     * Предпоставлено
     */
    public final TableField<DecisionFormationStatusRecord, Long> COUNT_SUGGESTED = createField(DSL.name("count_suggested"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Предпоставлено");

    /**
     * The column
     * <code>init_registration_info.decision_formation_status.count_waiting_sign</code>.
     */
    public final TableField<DecisionFormationStatusRecord, Long> COUNT_WAITING_SIGN = createField(DSL.name("count_waiting_sign"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>init_registration_info.decision_formation_status.count_refused</code>.
     */
    public final TableField<DecisionFormationStatusRecord, Long> COUNT_REFUSED = createField(DSL.name("count_refused"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

    private DecisionFormationStatus(Name alias, Table<DecisionFormationStatusRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Первоначальная постановка на учет. Статус формирования решений"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased
     * <code>init_registration_info.decision_formation_status</code> table
     * reference
     */
    public DecisionFormationStatus(Name alias) {
        this(alias, DECISION_FORMATION_STATUS);
    }

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

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

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

    @Override
    public UniqueKey<DecisionFormationStatusRecord> getPrimaryKey() {
        return Keys.DECISION_FORMATION_STATUS_PKEY;
    }

    @Override
    public List<Check<DecisionFormationStatusRecord>> 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, ('EPGU'::character varying)::text])))", true),
            Internal.createCheck(this, DSL.name("chk_info_source"), "(((info_source)::text = ANY (ARRAY[('PERSONAL_VISIT'::character varying)::text, ('GIR_VU'::character varying)::text, ('EPGU'::character varying)::text])))", true)
        );
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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