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


/**
 * Постановка на воинский учет при смене адреса. Граждане, поставленные на ВУ
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class RecordsAboutRegistratedCitizen extends TableImpl<RecordsAboutRegistratedCitizenRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>registration_change_address.records_about_registrated_citizen</code>
     */
    public static final RecordsAboutRegistratedCitizen RECORDS_ABOUT_REGISTRATED_CITIZEN = new RecordsAboutRegistratedCitizen();

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

    /**
     * The column
     * <code>registration_change_address.records_about_registrated_citizen.records_about_registrated_citizen_id</code>.
     */
    public final TableField<RecordsAboutRegistratedCitizenRecord, Long> RECORDS_ABOUT_REGISTRATED_CITIZEN_ID = createField(DSL.name("records_about_registrated_citizen_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>registration_change_address.records_about_registrated_citizen.count_registrated_by_app_vk</code>.
     */
    public final TableField<RecordsAboutRegistratedCitizenRecord, Long> COUNT_REGISTRATED_BY_APP_VK = createField(DSL.name("count_registrated_by_app_vk"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column
     * <code>registration_change_address.records_about_registrated_citizen.count_registrated_another_vk</code>.
     */
    public final TableField<RecordsAboutRegistratedCitizenRecord, Long> COUNT_REGISTRATED_ANOTHER_VK = createField(DSL.name("count_registrated_another_vk"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

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

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

    /**
     * Create an aliased
     * <code>registration_change_address.records_about_registrated_citizen</code>
     * table reference
     */
    public RecordsAboutRegistratedCitizen(Name alias) {
        this(alias, RECORDS_ABOUT_REGISTRATED_CITIZEN);
    }

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

    public <O extends Record> RecordsAboutRegistratedCitizen(Table<O> path, ForeignKey<O, RecordsAboutRegistratedCitizenRecord> childPath, InverseForeignKey<O, RecordsAboutRegistratedCitizenRecord> parentPath) {
        super(path, childPath, parentPath, RECORDS_ABOUT_REGISTRATED_CITIZEN);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<RecordsAboutRegistratedCitizenRecord> getPrimaryKey() {
        return Keys.RECORDS_ABOUT_REGISTRATED_CITIZEN_PKEY;
    }

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

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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