/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables;


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.DownloadForPrint.DownloadForPrintPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.FormedSummonses.FormedSummonsesPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.ImpositionTmpMeasures.ImpositionTmpMeasuresPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.InfoSentToLkEpgu.InfoSentToLkEpguPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.RecruitOfficeVisit.RecruitOfficeVisitPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.RemoveTmpMeasures.RemoveTmpMeasuresPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.RfLeavingBan.RfLeavingBanPath;
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.SummonsesReasonRecord;


/**
 * Реестр повесток. Причины выдачи повестки
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class SummonsesReason extends TableImpl<SummonsesReasonRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>summonses_list.summonses_reason</code>
     */
    public static final SummonsesReason SUMMONSES_REASON = new SummonsesReason();

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

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

    /**
     * The column
     * <code>summonses_list.summonses_reason.parent_summonses_reason_id</code>.
     * родительская причина
     */
    public final TableField<SummonsesReasonRecord, Long> PARENT_SUMMONSES_REASON_ID = createField(DSL.name("parent_summonses_reason_id"), SQLDataType.BIGINT, this, "родительская причина");

    /**
     * The column <code>summonses_list.summonses_reason.code</code>. код причины
     */
    public final TableField<SummonsesReasonRecord, String> CODE = createField(DSL.name("code"), SQLDataType.VARCHAR.nullable(false), this, "код причины");

    /**
     * The column <code>summonses_list.summonses_reason.name</code>.
     * наименование причины
     */
    public final TableField<SummonsesReasonRecord, String> NAME = createField(DSL.name("name"), SQLDataType.VARCHAR.nullable(false), this, "наименование причины");

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

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

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

    /**
     * Create an aliased <code>summonses_list.summonses_reason</code> table
     * reference
     */
    public SummonsesReason(Name alias) {
        this(alias, SUMMONSES_REASON);
    }

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

    public <O extends Record> SummonsesReason(Table<O> path, ForeignKey<O, SummonsesReasonRecord> childPath, InverseForeignKey<O, SummonsesReasonRecord> parentPath) {
        super(path, childPath, parentPath, SUMMONSES_REASON);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<SummonsesReasonRecord> getPrimaryKey() {
        return Keys.SUMMONSES_REASON_PKEY;
    }

    @Override
    public List<UniqueKey<SummonsesReasonRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.UNI_SUMMONSES_REASON1);
    }

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

        return _summonsesReason;
    }

    private transient DownloadForPrintPath _downloadForPrint;

    /**
     * Get the implicit to-many join path to the
     * <code>summonses_list.download_for_print</code> table
     */
    public DownloadForPrintPath downloadForPrint() {
        if (_downloadForPrint == null)
            _downloadForPrint = new DownloadForPrintPath(this, null, Keys.DOWNLOAD_FOR_PRINT__FK_SUMMONSES_REASON_ID.getInverseKey());

        return _downloadForPrint;
    }

    private transient FormedSummonsesPath _formedSummonses;

    /**
     * Get the implicit to-many join path to the
     * <code>summonses_list.formed_summonses</code> table
     */
    public FormedSummonsesPath formedSummonses() {
        if (_formedSummonses == null)
            _formedSummonses = new FormedSummonsesPath(this, null, Keys.FORMED_SUMMONSES__FK_SUMMONSES_REASON_ID.getInverseKey());

        return _formedSummonses;
    }

    private transient ImpositionTmpMeasuresPath _impositionTmpMeasures;

    /**
     * Get the implicit to-many join path to the
     * <code>summonses_list.imposition_tmp_measures</code> table
     */
    public ImpositionTmpMeasuresPath impositionTmpMeasures() {
        if (_impositionTmpMeasures == null)
            _impositionTmpMeasures = new ImpositionTmpMeasuresPath(this, null, Keys.IMPOSITION_TMP_MEASURES__FK_SUMMONSES_REASON_ID.getInverseKey());

        return _impositionTmpMeasures;
    }

    private transient InfoSentToLkEpguPath _infoSentToLkEpgu;

    /**
     * Get the implicit to-many join path to the
     * <code>summonses_list.info_sent_to_lk_epgu</code> table
     */
    public InfoSentToLkEpguPath infoSentToLkEpgu() {
        if (_infoSentToLkEpgu == null)
            _infoSentToLkEpgu = new InfoSentToLkEpguPath(this, null, Keys.INFO_SENT_TO_LK_EPGU__FK_SUMMONSES_REASON_ID.getInverseKey());

        return _infoSentToLkEpgu;
    }

    private transient RecruitOfficeVisitPath _recruitOfficeVisit;

    /**
     * Get the implicit to-many join path to the
     * <code>summonses_list.recruit_office_visit</code> table
     */
    public RecruitOfficeVisitPath recruitOfficeVisit() {
        if (_recruitOfficeVisit == null)
            _recruitOfficeVisit = new RecruitOfficeVisitPath(this, null, Keys.RECRUIT_OFFICE_VISIT__FK_SUMMONSES_REASON_ID.getInverseKey());

        return _recruitOfficeVisit;
    }

    private transient RemoveTmpMeasuresPath _removeTmpMeasures;

    /**
     * Get the implicit to-many join path to the
     * <code>summonses_list.remove_tmp_measures</code> table
     */
    public RemoveTmpMeasuresPath removeTmpMeasures() {
        if (_removeTmpMeasures == null)
            _removeTmpMeasures = new RemoveTmpMeasuresPath(this, null, Keys.REMOVE_TMP_MEASURES__FK_SUMMONSES_REASON_ID.getInverseKey());

        return _removeTmpMeasures;
    }

    private transient RfLeavingBanPath _rfLeavingBan;

    /**
     * Get the implicit to-many join path to the
     * <code>summonses_list.rf_leaving_ban</code> table
     */
    public RfLeavingBanPath rfLeavingBan() {
        if (_rfLeavingBan == null)
            _rfLeavingBan = new RfLeavingBanPath(this, null, Keys.RF_LEAVING_BAN__FK_SUMMONSES_REASON_ID.getInverseKey());

        return _rfLeavingBan;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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