/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.registration_change_address.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.registration_change_address.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.registration_change_address.RegistrationChangeAddress;
import ru.micord.webbpm.ervu.business_metrics.db_beans.registration_change_address.tables.records.InactiveAppEpguRecord;


/**
 * Постановка на воинский учет при смене адреса. Кол-во неактивных заявлений в
 * ЕПГУ
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class InactiveAppEpgu extends TableImpl<InactiveAppEpguRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>registration_change_address.inactive_app_epgu</code>
     */
    public static final InactiveAppEpgu INACTIVE_APP_EPGU = new InactiveAppEpgu();

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

    /**
     * The column
     * <code>registration_change_address.inactive_app_epgu.inactive_app_epgu_id</code>.
     */
    public final TableField<InactiveAppEpguRecord, Long> INACTIVE_APP_EPGU_ID = createField(DSL.name("inactive_app_epgu_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>registration_change_address.inactive_app_epgu.count_inactive_app_epgu</code>.
     */
    public final TableField<InactiveAppEpguRecord, Long> COUNT_INACTIVE_APP_EPGU = createField(DSL.name("count_inactive_app_epgu"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

    private InactiveAppEpgu(Name alias, Table<InactiveAppEpguRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Постановка на воинский учет при смене адреса. Кол-во неактивных заявлений в ЕПГУ"), TableOptions.table(), where);
    }

    /**
     * Create an aliased
     * <code>registration_change_address.inactive_app_epgu</code> table
     * reference
     */
    public InactiveAppEpgu(String alias) {
        this(DSL.name(alias), INACTIVE_APP_EPGU);
    }

    /**
     * Create an aliased
     * <code>registration_change_address.inactive_app_epgu</code> table
     * reference
     */
    public InactiveAppEpgu(Name alias) {
        this(alias, INACTIVE_APP_EPGU);
    }

    /**
     * Create a <code>registration_change_address.inactive_app_epgu</code> table
     * reference
     */
    public InactiveAppEpgu() {
        this(DSL.name("inactive_app_epgu"), null);
    }

    public <O extends Record> InactiveAppEpgu(Table<O> path, ForeignKey<O, InactiveAppEpguRecord> childPath, InverseForeignKey<O, InactiveAppEpguRecord> parentPath) {
        super(path, childPath, parentPath, INACTIVE_APP_EPGU);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<InactiveAppEpguRecord> getPrimaryKey() {
        return Keys.INACTIVE_APP_EPGU_PKEY;
    }

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

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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