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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>summonses_list.remove_tmp_measures</code>
     */
    public static final RemoveTmpMeasures REMOVE_TMP_MEASURES = new RemoveTmpMeasures();

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

    /**
     * The column
     * <code>summonses_list.remove_tmp_measures.remove_tmp_measures_id</code>.
     */
    public final TableField<RemoveTmpMeasuresRecord, Long> REMOVE_TMP_MEASURES_ID = createField(DSL.name("remove_tmp_measures_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

    /**
     * The column <code>summonses_list.remove_tmp_measures.count_formed</code>.
     * сформировано решений
     */
    public final TableField<RemoveTmpMeasuresRecord, 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.remove_tmp_measures.count_for_sign</code>. доступно
     * для подписания
     */
    public final TableField<RemoveTmpMeasuresRecord, 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.remove_tmp_measures.count_signed</code>.
     * подписано
     */
    public final TableField<RemoveTmpMeasuresRecord, 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.remove_tmp_measures.count_removed</code>.
     * снято временных мер
     */
    public final TableField<RemoveTmpMeasuresRecord, Long> COUNT_REMOVED = createField(DSL.name("count_removed"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "снято временных мер");

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

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

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

    /**
     * Create an aliased <code>summonses_list.remove_tmp_measures</code> table
     * reference
     */
    public RemoveTmpMeasures(Name alias) {
        this(alias, REMOVE_TMP_MEASURES);
    }

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

    public <O extends Record> RemoveTmpMeasures(Table<O> path, ForeignKey<O, RemoveTmpMeasuresRecord> childPath, InverseForeignKey<O, RemoveTmpMeasuresRecord> parentPath) {
        super(path, childPath, parentPath, REMOVE_TMP_MEASURES);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<RemoveTmpMeasuresRecord> getPrimaryKey() {
        return Keys.REMOVE_TMP_MEASURES_PKEY;
    }

    @Override
    public List<ForeignKey<RemoveTmpMeasuresRecord, ?>> getReferences() {
        return Arrays.asList(Keys.REMOVE_TMP_MEASURES__FK_CRIMINAL_ADMINISTRATIVE_LIABILITY_RECRUITMENT_ID, Keys.REMOVE_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.REMOVE_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.REMOVE_TMP_MEASURES__FK_SUMMONSES_REASON_ID, null);

        return _summonsesReason;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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