/*
 * 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.ImpositionTmpMeasuresRecord;


/**
 * Реестр повесток. Решение о принятии временных мер
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ImpositionTmpMeasures extends TableImpl<ImpositionTmpMeasuresRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>summonses_list.imposition_tmp_measures</code>
     */
    public static final ImpositionTmpMeasures IMPOSITION_TMP_MEASURES = new ImpositionTmpMeasures();

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

    /**
     * The column
     * <code>summonses_list.imposition_tmp_measures.imposition_tmp_measures_id</code>.
     */
    public final TableField<ImpositionTmpMeasuresRecord, Long> IMPOSITION_TMP_MEASURES_ID = createField(DSL.name("imposition_tmp_measures_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

    /**
     * The column
     * <code>summonses_list.imposition_tmp_measures.count_for_sign</code>.
     * доступно для подписания
     */
    public final TableField<ImpositionTmpMeasuresRecord, Long> COUNT_FOR_SIGN = createField(DSL.name("count_for_sign"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "доступно для подписания");

    /**
     * The column
     * <code>summonses_list.imposition_tmp_measures.count_apply</code>.
     * применена мера
     */
    public final TableField<ImpositionTmpMeasuresRecord, Long> COUNT_APPLY = createField(DSL.name("count_apply"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "применена мера");

    /**
     * The column
     * <code>summonses_list.imposition_tmp_measures.count_enter</code>. введлена
     * мера
     */
    public final TableField<ImpositionTmpMeasuresRecord, Long> COUNT_ENTER = createField(DSL.name("count_enter"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "введлена мера");

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

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

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

    /**
     * Create an aliased <code>summonses_list.imposition_tmp_measures</code>
     * table reference
     */
    public ImpositionTmpMeasures(Name alias) {
        this(alias, IMPOSITION_TMP_MEASURES);
    }

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

    public <O extends Record> ImpositionTmpMeasures(Table<O> path, ForeignKey<O, ImpositionTmpMeasuresRecord> childPath, InverseForeignKey<O, ImpositionTmpMeasuresRecord> parentPath) {
        super(path, childPath, parentPath, IMPOSITION_TMP_MEASURES);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<ImpositionTmpMeasuresRecord> getPrimaryKey() {
        return Keys.IMPOSITION_TMP_MEASURES_PKEY;
    }

    @Override
    public List<ForeignKey<ImpositionTmpMeasuresRecord, ?>> getReferences() {
        return Arrays.asList(Keys.IMPOSITION_TMP_MEASURES__FK_CRIMINAL_ADMINISTRATIVE_LIABILITY_RECRUITMENT_ID, Keys.IMPOSITION_TMP_MEASURES__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.IMPOSITION_TMP_MEASURES__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.IMPOSITION_TMP_MEASURES__FK_SUMMONSES_REASON_ID, null);

        return _summonsesReason;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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