/*
 * 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.metrics.tables.Recruitment.RecruitmentPath;
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.records.AllSummonsesRecord;


/**
 * Реестр повесток. Список всех повесток
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class AllSummonses extends TableImpl<AllSummonsesRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>summonses_list.all_summonses</code>
     */
    public static final AllSummonses ALL_SUMMONSES = new AllSummonses();

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

    /**
     * The column <code>summonses_list.all_summonses.all_summonses_id</code>.
     */
    public final TableField<AllSummonsesRecord, Long> ALL_SUMMONSES_ID = createField(DSL.name("all_summonses_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>summonses_list.all_summonses.count_init_registration</code>. в
     * рамках первоначальной постановки на ВУ
     */
    public final TableField<AllSummonsesRecord, Long> COUNT_INIT_REGISTRATION = createField(DSL.name("count_init_registration"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "в рамках первоначальной постановки на ВУ");

    /**
     * The column <code>summonses_list.all_summonses.count_draft_company</code>.
     * в рамках призывной кампании
     */
    public final TableField<AllSummonsesRecord, Long> COUNT_DRAFT_COMPANY = createField(DSL.name("count_draft_company"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "в рамках призывной кампании");

    /**
     * The column
     * <code>summonses_list.all_summonses.count_management_military_registration</code>.
     * в рамках ведения воинского учета
     */
    public final TableField<AllSummonsesRecord, Long> COUNT_MANAGEMENT_MILITARY_REGISTRATION = createField(DSL.name("count_management_military_registration"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "в рамках ведения воинского учета");

    /**
     * The column <code>summonses_list.all_summonses.count_mobilization</code>.
     * в рамках мобилизации
     */
    public final TableField<AllSummonsesRecord, Long> COUNT_MOBILIZATION = createField(DSL.name("count_mobilization"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "в рамках мобилизации");

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

    private AllSummonses(Name alias, Table<AllSummonsesRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Реестр повесток. Список всех повесток"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>summonses_list.all_summonses</code> table
     * reference
     */
    public AllSummonses(Name alias) {
        this(alias, ALL_SUMMONSES);
    }

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

    public <O extends Record> AllSummonses(Table<O> path, ForeignKey<O, AllSummonsesRecord> childPath, InverseForeignKey<O, AllSummonsesRecord> parentPath) {
        super(path, childPath, parentPath, ALL_SUMMONSES);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<AllSummonsesRecord> getPrimaryKey() {
        return Keys.ALL_SUMMONSES_PKEY;
    }

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

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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