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


/**
 * Реестр повесток. Решение о применении временной меры - запрет на выезд из РФ
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class RfLeavingBan extends TableImpl<RfLeavingBanRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>summonses_list.rf_leaving_ban</code>
     */
    public static final RfLeavingBan RF_LEAVING_BAN = new RfLeavingBan();

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

    /**
     * The column <code>summonses_list.rf_leaving_ban.rf_leaving_ban_id</code>.
     */
    public final TableField<RfLeavingBanRecord, Long> RF_LEAVING_BAN_ID = createField(DSL.name("rf_leaving_ban_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

    /**
     * The column <code>summonses_list.rf_leaving_ban.count_for_sign</code>.
     * доступно для подписания
     */
    public final TableField<RfLeavingBanRecord, 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.rf_leaving_ban.count_signed</code>.
     * применена мера
     */
    public final TableField<RfLeavingBanRecord, 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.rf_leaving_ban.count_enter</code>.
     * введлена мера
     */
    public final TableField<RfLeavingBanRecord, Long> COUNT_ENTER = createField(DSL.name("count_enter"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "введлена мера");

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

    private RfLeavingBan(Name alias, Table<RfLeavingBanRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Реестр повесток. Решение о применении временной меры - запрет на выезд из РФ"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>summonses_list.rf_leaving_ban</code> table
     * reference
     */
    public RfLeavingBan(Name alias) {
        this(alias, RF_LEAVING_BAN);
    }

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

    public <O extends Record> RfLeavingBan(Table<O> path, ForeignKey<O, RfLeavingBanRecord> childPath, InverseForeignKey<O, RfLeavingBanRecord> parentPath) {
        super(path, childPath, parentPath, RF_LEAVING_BAN);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<RfLeavingBanRecord> getPrimaryKey() {
        return Keys.RF_LEAVING_BAN_PKEY;
    }

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

        return _summonsesReason;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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