/*
 * This file is generated by jOOQ.
 */
package ru.micord.ervu.account_applications.db_beans.public_.tables;


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

import org.jooq.Condition;
import org.jooq.Field;
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.SQLDataType;
import org.jooq.impl.TableImpl;

import ru.micord.ervu.account_applications.db_beans.public_.Keys;
import ru.micord.ervu.account_applications.db_beans.public_.Public;
import ru.micord.ervu.account_applications.db_beans.public_.tables.records.RecruitmentRecord;


/**
 * Военный комиссариат
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Recruitment extends TableImpl<RecruitmentRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>public.recruitment</code>
     */
    public static final Recruitment RECRUITMENT = new Recruitment();

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

    /**
     * The column <code>public.recruitment.id</code>. Идентификатор ВК
     */
    public final TableField<RecruitmentRecord, UUID> ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("uuid_generate_v4()"), SQLDataType.UUID)), this, "Идентификатор ВК");

    /**
     * The column <code>public.recruitment.idm_id</code>. Идентификатор
     * организации
     */
    public final TableField<RecruitmentRecord, String> IDM_ID = createField(DSL.name("idm_id"), SQLDataType.VARCHAR(256), this, "Идентификатор организации");

    /**
     * The column <code>public.recruitment.parent_id</code>. Идентификатор
     * вышестоящей организации
     */
    public final TableField<RecruitmentRecord, String> PARENT_ID = createField(DSL.name("parent_id"), SQLDataType.VARCHAR, this, "Идентификатор вышестоящей организации");

    /**
     * The column <code>public.recruitment.version</code>. Версия записи
     */
    public final TableField<RecruitmentRecord, Integer> VERSION = createField(DSL.name("version"), SQLDataType.INTEGER, this, "Версия записи");

    /**
     * The column <code>public.recruitment.created_at</code>. Дата создания
     */
    public final TableField<RecruitmentRecord, Timestamp> CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMP(0).nullable(false).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "Дата создания");

    /**
     * The column <code>public.recruitment.updated_at</code>. Дата обновления
     */
    public final TableField<RecruitmentRecord, Timestamp> UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMP(0).nullable(false).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "Дата обновления");

    /**
     * The column <code>public.recruitment.schema</code>. Схема
     */
    public final TableField<RecruitmentRecord, String> SCHEMA = createField(DSL.name("schema"), SQLDataType.VARCHAR(64).nullable(false), this, "Схема");

    /**
     * The column <code>public.recruitment.military_code</code>. Код организации
     */
    public final TableField<RecruitmentRecord, String> MILITARY_CODE = createField(DSL.name("military_code"), SQLDataType.VARCHAR(16), this, "Код организации");

    /**
     * The column <code>public.recruitment.shortname</code>. Укороченное
     * наименование организации
     */
    public final TableField<RecruitmentRecord, String> SHORTNAME = createField(DSL.name("shortname"), SQLDataType.VARCHAR.nullable(false), this, "Укороченное наименование организации");

    /**
     * The column <code>public.recruitment.fullname</code>. Полное наименование
     * организации
     */
    public final TableField<RecruitmentRecord, String> FULLNAME = createField(DSL.name("fullname"), SQLDataType.VARCHAR.nullable(false), this, "Полное наименование организации");

    /**
     * The column <code>public.recruitment.address_id</code>. Идентификатор
     * адреса организации
     */
    public final TableField<RecruitmentRecord, String> ADDRESS_ID = createField(DSL.name("address_id"), SQLDataType.VARCHAR, this, "Идентификатор адреса организации");

    /**
     * The column <code>public.recruitment.postal_address_id</code>.
     * Идентификатор почтового адреса организации
     */
    public final TableField<RecruitmentRecord, String> POSTAL_ADDRESS_ID = createField(DSL.name("postal_address_id"), SQLDataType.VARCHAR, this, "Идентификатор почтового адреса организации");

    /**
     * The column <code>public.recruitment.timezone</code>. Часовой пояс
     */
    public final TableField<RecruitmentRecord, String> TIMEZONE = createField(DSL.name("timezone"), SQLDataType.VARCHAR(64), this, "Часовой пояс");

    /**
     * The column <code>public.recruitment.reports_enabled</code>. Признак
     * актуальности для отчета
     */
    public final TableField<RecruitmentRecord, Boolean> REPORTS_ENABLED = createField(DSL.name("reports_enabled"), SQLDataType.BOOLEAN, this, "Признак актуальности для отчета");

    /**
     * The column <code>public.recruitment.subpoena_series_code</code>. Серия
     */
    public final TableField<RecruitmentRecord, String> SUBPOENA_SERIES_CODE = createField(DSL.name("subpoena_series_code"), SQLDataType.VARCHAR(64), this, "Серия");

    /**
     * The column <code>public.recruitment.region_code</code>.
     */
    public final TableField<RecruitmentRecord, String> REGION_CODE = createField(DSL.name("region_code"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>public.recruitment.ts</code>.
     */
    public final TableField<RecruitmentRecord, Timestamp> TS = createField(DSL.name("ts"), SQLDataType.TIMESTAMP(0).nullable(false).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "");

    /**
     * The column <code>public.recruitment.name</code>.
     */
    public final TableField<RecruitmentRecord, String> NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(255).defaultValue(DSL.field(DSL.raw("''::character varying"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>public.recruitment.active</code>.
     */
    public final TableField<RecruitmentRecord, Boolean> ACTIVE = createField(DSL.name("active"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("true"), SQLDataType.BOOLEAN)), this, "");

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

    private Recruitment(Name alias, Table<RecruitmentRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Военный комиссариат"), TableOptions.table(), where);
    }

    /**
     * Create an aliased <code>public.recruitment</code> table reference
     */
    public Recruitment(String alias) {
        this(DSL.name(alias), RECRUITMENT);
    }

    /**
     * Create an aliased <code>public.recruitment</code> table reference
     */
    public Recruitment(Name alias) {
        this(alias, RECRUITMENT);
    }

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

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

    @Override
    public UniqueKey<RecruitmentRecord> getPrimaryKey() {
        return Keys.RECRUITMENT_PKEY;
    }

    @Override
    public List<UniqueKey<RecruitmentRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.RECRUITMENT_IDM_ID_KEY);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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