/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.deregistration.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.deregistration.Deregistration;
import ru.micord.webbpm.ervu.business_metrics.db_beans.deregistration.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.deregistration.tables.records.RemovalRegistrationRecord;
import ru.micord.webbpm.ervu.business_metrics.db_beans.metrics.tables.Recruitment.RecruitmentPath;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class RemovalRegistration extends TableImpl<RemovalRegistrationRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>deregistration.removal_registration</code>
     */
    public static final RemovalRegistration REMOVAL_REGISTRATION = new RemovalRegistration();

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

    /**
     * The column
     * <code>deregistration.removal_registration.removal_registration_id</code>.
     */
    public final TableField<RemovalRegistrationRecord, Long> REMOVAL_REGISTRATION_ID = createField(DSL.name("removal_registration_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>deregistration.removal_registration.count_age_limit</code>.
     */
    public final TableField<RemovalRegistrationRecord, Long> COUNT_AGE_LIMIT = createField(DSL.name("count_age_limit"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>deregistration.removal_registration.count_reason_death</code>.
     */
    public final TableField<RemovalRegistrationRecord, Long> COUNT_REASON_DEATH = createField(DSL.name("count_reason_death"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>deregistration.removal_registration.count_loss_citizenship</code>.
     */
    public final TableField<RemovalRegistrationRecord, Long> COUNT_LOSS_CITIZENSHIP = createField(DSL.name("count_loss_citizenship"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>deregistration.removal_registration.count_cancellation_record</code>.
     */
    public final TableField<RemovalRegistrationRecord, Long> COUNT_CANCELLATION_RECORD = createField(DSL.name("count_cancellation_record"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

    private RemovalRegistration(Name alias, Table<RemovalRegistrationRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where);
    }

    /**
     * Create an aliased <code>deregistration.removal_registration</code> table
     * reference
     */
    public RemovalRegistration(String alias) {
        this(DSL.name(alias), REMOVAL_REGISTRATION);
    }

    /**
     * Create an aliased <code>deregistration.removal_registration</code> table
     * reference
     */
    public RemovalRegistration(Name alias) {
        this(alias, REMOVAL_REGISTRATION);
    }

    /**
     * Create a <code>deregistration.removal_registration</code> table reference
     */
    public RemovalRegistration() {
        this(DSL.name("removal_registration"), null);
    }

    public <O extends Record> RemovalRegistration(Table<O> path, ForeignKey<O, RemovalRegistrationRecord> childPath, InverseForeignKey<O, RemovalRegistrationRecord> parentPath) {
        super(path, childPath, parentPath, REMOVAL_REGISTRATION);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<RemovalRegistrationRecord> getPrimaryKey() {
        return Keys.REMOVAL_REGISTRATION_PKEY;
    }

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

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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