/*
 * 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.Condition;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.InverseForeignKey;
import org.jooq.Name;
import org.jooq.Path;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
import org.jooq.Record;
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.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.DictionaryUpdateRecord;
import ru.micord.webbpm.ervu.business_metrics.db_beans.metrics.tables.Recruitment.RecruitmentPath;


/**
 * Журналирование. Обновление справочников
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DictionaryUpdate extends TableImpl<DictionaryUpdateRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>journal_log.dictionary_update</code>
     */
    public static final DictionaryUpdate DICTIONARY_UPDATE = new DictionaryUpdate();

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

    /**
     * The column
     * <code>journal_log.dictionary_update.dictionary_update_id</code>.
     */
    public final TableField<DictionaryUpdateRecord, Long> DICTIONARY_UPDATE_ID = createField(DSL.name("dictionary_update_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column <code>journal_log.dictionary_update.count_dictionary_1</code>.
     */
    public final TableField<DictionaryUpdateRecord, Long> COUNT_DICTIONARY_1 = createField(DSL.name("count_dictionary_1"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column <code>journal_log.dictionary_update.count_dictionary_2</code>.
     */
    public final TableField<DictionaryUpdateRecord, Long> COUNT_DICTIONARY_2 = createField(DSL.name("count_dictionary_2"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column <code>journal_log.dictionary_update.count_dictionary_3</code>.
     */
    public final TableField<DictionaryUpdateRecord, Long> COUNT_DICTIONARY_3 = createField(DSL.name("count_dictionary_3"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column <code>journal_log.dictionary_update.count_dictionary_4</code>.
     */
    public final TableField<DictionaryUpdateRecord, Long> COUNT_DICTIONARY_4 = createField(DSL.name("count_dictionary_4"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column <code>journal_log.dictionary_update.name_dictionary_1</code>.
     */
    public final TableField<DictionaryUpdateRecord, String> NAME_DICTIONARY_1 = createField(DSL.name("name_dictionary_1"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>journal_log.dictionary_update.name_dictionary_2</code>.
     */
    public final TableField<DictionaryUpdateRecord, String> NAME_DICTIONARY_2 = createField(DSL.name("name_dictionary_2"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>journal_log.dictionary_update.name_dictionary_3</code>.
     */
    public final TableField<DictionaryUpdateRecord, String> NAME_DICTIONARY_3 = createField(DSL.name("name_dictionary_3"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>journal_log.dictionary_update.name_dictionary_4</code>.
     */
    public final TableField<DictionaryUpdateRecord, String> NAME_DICTIONARY_4 = createField(DSL.name("name_dictionary_4"), SQLDataType.VARCHAR.nullable(false), this, "");

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

    private DictionaryUpdate(Name alias, Table<DictionaryUpdateRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Журналирование. Обновление справочников"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>journal_log.dictionary_update</code> table
     * reference
     */
    public DictionaryUpdate(Name alias) {
        this(alias, DICTIONARY_UPDATE);
    }

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

    public <O extends Record> DictionaryUpdate(Table<O> path, ForeignKey<O, DictionaryUpdateRecord> childPath, InverseForeignKey<O, DictionaryUpdateRecord> parentPath) {
        super(path, childPath, parentPath, DICTIONARY_UPDATE);
    }

    /**
     * A subtype implementing {@link Path} for simplified path-based joins.
     */
    public static class DictionaryUpdatePath extends DictionaryUpdate implements Path<DictionaryUpdateRecord> {
        public <O extends Record> DictionaryUpdatePath(Table<O> path, ForeignKey<O, DictionaryUpdateRecord> childPath, InverseForeignKey<O, DictionaryUpdateRecord> parentPath) {
            super(path, childPath, parentPath);
        }
        private DictionaryUpdatePath(Name alias, Table<DictionaryUpdateRecord> aliased) {
            super(alias, aliased);
        }

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

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

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

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

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

    @Override
    public UniqueKey<DictionaryUpdateRecord> getPrimaryKey() {
        return Keys.DICTIONARY_UPDATE_PKEY;
    }

    @Override
    public List<ForeignKey<DictionaryUpdateRecord, ?>> getReferences() {
        return Arrays.asList(Keys.DICTIONARY_UPDATE__FK_CONV_INFO_RECORDS_FROM_EASU_RECRUITMENT_ID);
    }

    private transient RecruitmentPath _recruitment;

    /**
     * Get the implicit join path to the <code>metrics.recruitment</code> table.
     */
    public RecruitmentPath recruitment() {
        if (_recruitment == null)
            _recruitment = new RecruitmentPath(this, Keys.DICTIONARY_UPDATE__FK_CONV_INFO_RECORDS_FROM_EASU_RECRUITMENT_ID, null);

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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