/*
 * 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.ApplicationsSentFromEpguRecord;
import ru.micord.webbpm.ervu.business_metrics.db_beans.metrics.tables.Recruitment.RecruitmentPath;


/**
 * Снятие с воинского учета. Отправленные заявления ЕПГУ
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ApplicationsSentFromEpgu extends TableImpl<ApplicationsSentFromEpguRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>deregistration.applications_sent_from_epgu</code>
     */
    public static final ApplicationsSentFromEpgu APPLICATIONS_SENT_FROM_EPGU = new ApplicationsSentFromEpgu();

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

    /**
     * The column
     * <code>deregistration.applications_sent_from_epgu.applications_sent_from_epgu_id</code>.
     */
    public final TableField<ApplicationsSentFromEpguRecord, Long> APPLICATIONS_SENT_FROM_EPGU_ID = createField(DSL.name("applications_sent_from_epgu_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>deregistration.applications_sent_from_epgu.count_moved_residence</code>.
     */
    public final TableField<ApplicationsSentFromEpguRecord, Long> COUNT_MOVED_RESIDENCE = createField(DSL.name("count_moved_residence"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>deregistration.applications_sent_from_epgu.count_departure_more_6_month</code>.
     */
    public final TableField<ApplicationsSentFromEpguRecord, Long> COUNT_DEPARTURE_MORE_6_MONTH = createField(DSL.name("count_departure_more_6_month"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>deregistration.applications_sent_from_epgu.count_health_condition</code>.
     */
    public final TableField<ApplicationsSentFromEpguRecord, Long> COUNT_HEALTH_CONDITION = createField(DSL.name("count_health_condition"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

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

    private ApplicationsSentFromEpgu(Name alias, Table<ApplicationsSentFromEpguRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Снятие с воинского учета. Отправленные заявления ЕПГУ"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>deregistration.applications_sent_from_epgu</code>
     * table reference
     */
    public ApplicationsSentFromEpgu(Name alias) {
        this(alias, APPLICATIONS_SENT_FROM_EPGU);
    }

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

    public <O extends Record> ApplicationsSentFromEpgu(Table<O> path, ForeignKey<O, ApplicationsSentFromEpguRecord> childPath, InverseForeignKey<O, ApplicationsSentFromEpguRecord> parentPath) {
        super(path, childPath, parentPath, APPLICATIONS_SENT_FROM_EPGU);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<ApplicationsSentFromEpguRecord> getPrimaryKey() {
        return Keys.APPLICATIONS_SENT_FROM_EPGU_PKEY;
    }

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

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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