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


/**
 * Первоначальная постановка на учет. Инциденты
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class IncidentsInfo extends TableImpl<IncidentsInfoRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>init_registration_info.incidents_info</code>
     */
    public static final IncidentsInfo INCIDENTS_INFO = new IncidentsInfo();

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

    /**
     * The column
     * <code>init_registration_info.incidents_info.incidents_info_id</code>.
     */
    public final TableField<IncidentsInfoRecord, Long> INCIDENTS_INFO_ID = createField(DSL.name("incidents_info_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

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

    /**
     * The column
     * <code>init_registration_info.incidents_info.count_without_id_ern</code>.
     */
    public final TableField<IncidentsInfoRecord, Long> COUNT_WITHOUT_ID_ERN = createField(DSL.name("count_without_id_ern"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>init_registration_info.incidents_info.count_discrepancy_epgu_info</code>.
     */
    public final TableField<IncidentsInfoRecord, Long> COUNT_DISCREPANCY_EPGU_INFO = createField(DSL.name("count_discrepancy_epgu_info"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

    private IncidentsInfo(Name alias, Table<IncidentsInfoRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Первоначальная постановка на учет. Инциденты"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>init_registration_info.incidents_info</code>
     * table reference
     */
    public IncidentsInfo(Name alias) {
        this(alias, INCIDENTS_INFO);
    }

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

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

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

    @Override
    public UniqueKey<IncidentsInfoRecord> getPrimaryKey() {
        return Keys.INCIDENTS_INFO_PKEY;
    }

    @Override
    public List<Check<IncidentsInfoRecord>> 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 IncidentsInfo as(String alias) {
        return new IncidentsInfo(DSL.name(alias), this);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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