/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.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.journal_log.JournalLog;
import ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.tables.records.LoadRecordJourRecord;


/**
 * Журналирование. Журнал загрузки записей. Загруженные и незагруженные записи
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class LoadRecordJour extends TableImpl<LoadRecordJourRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>journal_log.load_record_jour</code>
     */
    public static final LoadRecordJour LOAD_RECORD_JOUR = new LoadRecordJour();

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

    /**
     * The column <code>journal_log.load_record_jour.load_record_jour_id</code>.
     */
    public final TableField<LoadRecordJourRecord, Long> LOAD_RECORD_JOUR_ID = createField(DSL.name("load_record_jour_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column <code>journal_log.load_record_jour.info_source</code>.
     * результат загрузки LOAD - успешно загружено, ERROR - ошибка загрузки
     */
    public final TableField<LoadRecordJourRecord, String> INFO_SOURCE = createField(DSL.name("info_source"), SQLDataType.VARCHAR.nullable(false), this, "результат загрузки LOAD - успешно загружено, ERROR - ошибка загрузки");

    /**
     * The column <code>journal_log.load_record_jour.count_inform_system</code>.
     * из информ. систем МО РФ
     */
    public final TableField<LoadRecordJourRecord, Long> COUNT_INFORM_SYSTEM = createField(DSL.name("count_inform_system"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "из информ. систем МО РФ");

    /**
     * The column <code>journal_log.load_record_jour.count_gir_vu</code>. из ГИР
     * ВУ
     */
    public final TableField<LoadRecordJourRecord, Long> COUNT_GIR_VU = createField(DSL.name("count_gir_vu"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "из ГИР ВУ");

    /**
     * The column
     * <code>journal_log.load_record_jour.count_compare_citizen_info</code>.
     * сверка сведений граждан
     */
    public final TableField<LoadRecordJourRecord, Long> COUNT_COMPARE_CITIZEN_INFO = createField(DSL.name("count_compare_citizen_info"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "сверка сведений граждан");

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

    private LoadRecordJour(Name alias, Table<LoadRecordJourRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Журналирование. Журнал загрузки записей. Загруженные и незагруженные записи"), TableOptions.table(), where);
    }

    /**
     * Create an aliased <code>journal_log.load_record_jour</code> table
     * reference
     */
    public LoadRecordJour(String alias) {
        this(DSL.name(alias), LOAD_RECORD_JOUR);
    }

    /**
     * Create an aliased <code>journal_log.load_record_jour</code> table
     * reference
     */
    public LoadRecordJour(Name alias) {
        this(alias, LOAD_RECORD_JOUR);
    }

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

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

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

    @Override
    public UniqueKey<LoadRecordJourRecord> getPrimaryKey() {
        return Keys.LOAD_RECORD_JOUR_PKEY;
    }

    @Override
    public List<Check<LoadRecordJourRecord>> getChecks() {
        return Arrays.asList(
            Internal.createCheck(this, DSL.name("chk_info_source"), "(((info_source)::text = ANY (ARRAY[('LOAD'::character varying)::text, ('ERROR'::character varying)::text])))", true)
        );
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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