/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.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.summonses_list.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.SummonsesList;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.SummonsesReason.SummonsesReasonPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.records.RecruitOfficeVisitRecord;


/**
 * Реестр повесток. Явка в военный комиссариат
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class RecruitOfficeVisit extends TableImpl<RecruitOfficeVisitRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>summonses_list.recruit_office_visit</code>
     */
    public static final RecruitOfficeVisit RECRUIT_OFFICE_VISIT = new RecruitOfficeVisit();

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

    /**
     * The column
     * <code>summonses_list.recruit_office_visit.recruit_office_visit_id</code>.
     */
    public final TableField<RecruitOfficeVisitRecord, Long> RECRUIT_OFFICE_VISIT_ID = createField(DSL.name("recruit_office_visit_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>summonses_list.recruit_office_visit.summonses_reason_id</code>.
     */
    public final TableField<RecruitOfficeVisitRecord, Long> SUMMONSES_REASON_ID = createField(DSL.name("summonses_reason_id"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>summonses_list.recruit_office_visit.count_visit</code>.
     * явились
     */
    public final TableField<RecruitOfficeVisitRecord, Long> COUNT_VISIT = createField(DSL.name("count_visit"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "явились");

    /**
     * The column
     * <code>summonses_list.recruit_office_visit.count_not_visit</code>. не
     * явились
     */
    public final TableField<RecruitOfficeVisitRecord, Long> COUNT_NOT_VISIT = createField(DSL.name("count_not_visit"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "не явились");

    /**
     * The column
     * <code>summonses_list.recruit_office_visit.count_valid_reason</code>. не
     * явились по уважительной причине
     */
    public final TableField<RecruitOfficeVisitRecord, Long> COUNT_VALID_REASON = createField(DSL.name("count_valid_reason"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "не явились по уважительной причине");

    /**
     * The column
     * <code>summonses_list.recruit_office_visit.count_not_need</code>. явка не
     * требовалась
     */
    public final TableField<RecruitOfficeVisitRecord, Long> COUNT_NOT_NEED = createField(DSL.name("count_not_need"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "явка не требовалась");

    /**
     * The column
     * <code>summonses_list.recruit_office_visit.count_hand_over_not_need</code>.
     */
    public final TableField<RecruitOfficeVisitRecord, Long> COUNT_HAND_OVER_NOT_NEED = createField(DSL.name("count_hand_over_not_need"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

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

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

    /**
     * Create an aliased <code>summonses_list.recruit_office_visit</code> table
     * reference
     */
    public RecruitOfficeVisit(Name alias) {
        this(alias, RECRUIT_OFFICE_VISIT);
    }

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

    public <O extends Record> RecruitOfficeVisit(Table<O> path, ForeignKey<O, RecruitOfficeVisitRecord> childPath, InverseForeignKey<O, RecruitOfficeVisitRecord> parentPath) {
        super(path, childPath, parentPath, RECRUIT_OFFICE_VISIT);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<RecruitOfficeVisitRecord> getPrimaryKey() {
        return Keys.RECRUIT_OFFICE_VISIT_PKEY;
    }

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

    private transient SummonsesReasonPath _summonsesReason;

    /**
     * Get the implicit join path to the
     * <code>summonses_list.summonses_reason</code> table.
     */
    public SummonsesReasonPath summonsesReason() {
        if (_summonsesReason == null)
            _summonsesReason = new SummonsesReasonPath(this, Keys.RECRUIT_OFFICE_VISIT__FK_SUMMONSES_REASON_ID, null);

        return _summonsesReason;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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