/*
 * 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.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.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.ProcessingTimeFilesAndRecordsRecord;
import ru.micord.webbpm.ervu.business_metrics.db_beans.metrics.tables.Recruitment.RecruitmentPath;


/**
 * Журналирование. Журнал загрузки записей. Среднее время обработки файлов и
 * записей
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ProcessingTimeFilesAndRecords extends TableImpl<ProcessingTimeFilesAndRecordsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>journal_log.processing_time_files_and_records</code>
     */
    public static final ProcessingTimeFilesAndRecords PROCESSING_TIME_FILES_AND_RECORDS = new ProcessingTimeFilesAndRecords();

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

    /**
     * The column
     * <code>journal_log.processing_time_files_and_records.processing_time_files_and_records_id</code>.
     */
    public final TableField<ProcessingTimeFilesAndRecordsRecord, Long> PROCESSING_TIME_FILES_AND_RECORDS_ID = createField(DSL.name("processing_time_files_and_records_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>journal_log.processing_time_files_and_records.info_source</code>.
     * тип фапйла CSV или XML
     */
    public final TableField<ProcessingTimeFilesAndRecordsRecord, String> INFO_SOURCE = createField(DSL.name("info_source"), SQLDataType.VARCHAR.nullable(false), this, "тип фапйла CSV или XML");

    /**
     * The column
     * <code>journal_log.processing_time_files_and_records.record_time_sec</code>.
     * время обработки записи
     */
    public final TableField<ProcessingTimeFilesAndRecordsRecord, Long> RECORD_TIME_SEC = createField(DSL.name("record_time_sec"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "время обработки записи");

    /**
     * The column
     * <code>journal_log.processing_time_files_and_records.file_time_sec</code>.
     * время обработки файла
     */
    public final TableField<ProcessingTimeFilesAndRecordsRecord, Long> FILE_TIME_SEC = createField(DSL.name("file_time_sec"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "время обработки файла");

    /**
     * The column
     * <code>journal_log.processing_time_files_and_records.count_files_in_record</code>.
     * количество записей в файле
     */
    public final TableField<ProcessingTimeFilesAndRecordsRecord, Long> COUNT_FILES_IN_RECORD = createField(DSL.name("count_files_in_record"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "количество записей в файле");

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

    private ProcessingTimeFilesAndRecords(Name alias, Table<ProcessingTimeFilesAndRecordsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Журналирование. Журнал загрузки записей. Среднее время обработки файлов и записей"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased
     * <code>journal_log.processing_time_files_and_records</code> table
     * reference
     */
    public ProcessingTimeFilesAndRecords(Name alias) {
        this(alias, PROCESSING_TIME_FILES_AND_RECORDS);
    }

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

    public <O extends Record> ProcessingTimeFilesAndRecords(Table<O> path, ForeignKey<O, ProcessingTimeFilesAndRecordsRecord> childPath, InverseForeignKey<O, ProcessingTimeFilesAndRecordsRecord> parentPath) {
        super(path, childPath, parentPath, PROCESSING_TIME_FILES_AND_RECORDS);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<ProcessingTimeFilesAndRecordsRecord> getPrimaryKey() {
        return Keys.PROCESSING_TIME_FILES_AND_RECORDS_PKEY;
    }

    @Override
    public List<ForeignKey<ProcessingTimeFilesAndRecordsRecord, ?>> getReferences() {
        return Arrays.asList(Keys.PROCESSING_TIME_FILES_AND_RECORDS__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.PROCESSING_TIME_FILES_AND_RECORDS__FK_CONV_INFO_RECORDS_FROM_EASU_RECRUITMENT_ID, null);

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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