/*
 * 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.SummonsesReason.SummonsesReasonPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.records.FormedSummonsesRecord;


/**
 * Реестр повесток. Количество сформированных повесток
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class FormedSummonses extends TableImpl<FormedSummonsesRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>summonses_list.formed_summonses</code>
     */
    public static final FormedSummonses FORMED_SUMMONSES = new FormedSummonses();

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

    /**
     * The column
     * <code>summonses_list.formed_summonses.formed_summonses_id</code>.
     */
    public final TableField<FormedSummonsesRecord, Long> FORMED_SUMMONSES_ID = createField(DSL.name("formed_summonses_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

    /**
     * The column <code>summonses_list.formed_summonses.count_formed</code>.
     * сформировано
     */
    public final TableField<FormedSummonsesRecord, Long> COUNT_FORMED = createField(DSL.name("count_formed"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "сформировано");

    /**
     * The column <code>summonses_list.formed_summonses.count_signed</code>.
     * подписано
     */
    public final TableField<FormedSummonsesRecord, Long> COUNT_SIGNED = createField(DSL.name("count_signed"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "подписано");

    /**
     * The column <code>summonses_list.formed_summonses.count_sent</code>.
     * направлено
     */
    public final TableField<FormedSummonsesRecord, Long> COUNT_SENT = createField(DSL.name("count_sent"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "направлено");

    /**
     * The column
     * <code>summonses_list.formed_summonses.count_delivered_on_hands</code>.
     * доставлено нарочно
     */
    public final TableField<FormedSummonsesRecord, Long> COUNT_DELIVERED_ON_HANDS = createField(DSL.name("count_delivered_on_hands"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "доставлено нарочно");

    /**
     * The column
     * <code>summonses_list.formed_summonses.count_delivered_by_letter</code>.
     * доставлено заказным письмом
     */
    public final TableField<FormedSummonsesRecord, Long> COUNT_DELIVERED_BY_LETTER = createField(DSL.name("count_delivered_by_letter"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "доставлено заказным письмом");

    /**
     * The column <code>summonses_list.formed_summonses.count_refused</code>.
     * отклоненные ВК
     */
    public final TableField<FormedSummonsesRecord, Long> COUNT_REFUSED = createField(DSL.name("count_refused"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "отклоненные ВК");

    /**
     * The column
     * <code>summonses_list.formed_summonses.count_auto_7_days</code>. врученные
     * автоматически через 7 дней
     */
    public final TableField<FormedSummonsesRecord, Long> COUNT_AUTO_7_DAYS = createField(DSL.name("count_auto_7_days"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "врученные автоматически через 7 дней");

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

    private FormedSummonses(Name alias, Table<FormedSummonsesRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Реестр повесток. Количество сформированных повесток"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>summonses_list.formed_summonses</code> table
     * reference
     */
    public FormedSummonses(Name alias) {
        this(alias, FORMED_SUMMONSES);
    }

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

    public <O extends Record> FormedSummonses(Table<O> path, ForeignKey<O, FormedSummonsesRecord> childPath, InverseForeignKey<O, FormedSummonsesRecord> parentPath) {
        super(path, childPath, parentPath, FORMED_SUMMONSES);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<FormedSummonsesRecord> getPrimaryKey() {
        return Keys.FORMED_SUMMONSES_PKEY;
    }

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

        return _recruitment;
    }

    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.FORMED_SUMMONSES__FK_SUMMONSES_REASON_ID, null);

        return _summonsesReason;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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