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


/**
 * Реестр повесток подсистема. Для прохождения призывной комиссии
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class SummonsesList extends TableImpl<SummonsesListRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>summonses_list_subsystem.summonses_list</code>
     */
    public static final SummonsesList SUMMONSES_LIST = new SummonsesList();

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

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.summonses_list_id</code>.
     */
    public final TableField<SummonsesListRecord, Long> SUMMONSES_LIST_ID = createField(DSL.name("summonses_list_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.summonse_type</code>. Тип
     * повестки (DRAFT_BOARD = призывная комиссия; MILITARY_SERVICE = отправка к
     * месту службы; MED_INSPECTION = медосвидетельствование; DOC_CLARIFICATION
     * = уточнение документов; NOT_REGISTERED = не состоит на учете)
     */
    public final TableField<SummonsesListRecord, String> SUMMONSE_TYPE = createField(DSL.name("summonse_type"), SQLDataType.VARCHAR.nullable(false), this, "Тип повестки (DRAFT_BOARD = призывная комиссия; MILITARY_SERVICE = отправка к месту службы; MED_INSPECTION = медосвидетельствование; DOC_CLARIFICATION = уточнение документов; NOT_REGISTERED = не состоит на учете)");

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.count_view_arrived</code>.
     * Гражданин явился, просмотрено
     */
    public final TableField<SummonsesListRecord, Long> COUNT_VIEW_ARRIVED = createField(DSL.name("count_view_arrived"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Гражданин явился, просмотрено");

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.count_not_view_arrived</code>.
     * Гражданин явился, не просмотрено
     */
    public final TableField<SummonsesListRecord, Long> COUNT_NOT_VIEW_ARRIVED = createField(DSL.name("count_not_view_arrived"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Гражданин явился, не просмотрено");

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.count_view_less_20_days</code>.
     * Менее 20 дней, просмотрено
     */
    public final TableField<SummonsesListRecord, Long> COUNT_VIEW_LESS_20_DAYS = createField(DSL.name("count_view_less_20_days"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Менее 20 дней, просмотрено");

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.count_not_view_less_20_days</code>.
     * Менее 20 дней, не просмотрено
     */
    public final TableField<SummonsesListRecord, Long> COUNT_NOT_VIEW_LESS_20_DAYS = createField(DSL.name("count_not_view_less_20_days"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Менее 20 дней, не просмотрено");

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.count_view_greater_20_days</code>.
     * Более 20 дней, просмотрено
     */
    public final TableField<SummonsesListRecord, Long> COUNT_VIEW_GREATER_20_DAYS = createField(DSL.name("count_view_greater_20_days"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Более 20 дней, просмотрено");

    /**
     * The column
     * <code>summonses_list_subsystem.summonses_list.count_not_view_greater_20_days</code>.
     * Более 20 дней, не просмотрено
     */
    public final TableField<SummonsesListRecord, Long> COUNT_NOT_VIEW_GREATER_20_DAYS = createField(DSL.name("count_not_view_greater_20_days"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "Более 20 дней, не просмотрено");

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

    private SummonsesList(Name alias, Table<SummonsesListRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Реестр повесток подсистема. Для прохождения призывной комиссии"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>summonses_list_subsystem.summonses_list</code>
     * table reference
     */
    public SummonsesList(Name alias) {
        this(alias, SUMMONSES_LIST);
    }

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

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

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

    @Override
    public UniqueKey<SummonsesListRecord> getPrimaryKey() {
        return Keys.SUMMONSES_LIST_PKEY;
    }

    @Override
    public List<Check<SummonsesListRecord>> getChecks() {
        return Arrays.asList(
            Internal.createCheck(this, DSL.name("chk_summonse_type"), "(((summonse_type)::text = ANY (ARRAY[('DRAFT_BOARD'::character varying)::text, ('MILITARY_SERVICE'::character varying)::text, ('MED_INSPECTION'::character varying)::text, ('DOC_CLARIFICATION'::character varying)::text, ('NOT_REGISTERED'::character varying)::text])))", true)
        );
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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