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


/**
 * Постановка на воинский учет при смене адреса. Сопоставление записей о
 * гражданине в ГИС ЕРВУ
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class CompareCitizenData extends TableImpl<CompareCitizenDataRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>registration_change_address.compare_citizen_data</code>
     */
    public static final CompareCitizenData COMPARE_CITIZEN_DATA = new CompareCitizenData();

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

    /**
     * The column
     * <code>registration_change_address.compare_citizen_data.compare_citizen_data_id</code>.
     */
    public final TableField<CompareCitizenDataRecord, Long> COMPARE_CITIZEN_DATA_ID = createField(DSL.name("compare_citizen_data_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>registration_change_address.compare_citizen_data.count_compare_record</code>.
     */
    public final TableField<CompareCitizenDataRecord, Long> COUNT_COMPARE_RECORD = createField(DSL.name("count_compare_record"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

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

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

    /**
     * Create an aliased
     * <code>registration_change_address.compare_citizen_data</code> table
     * reference
     */
    public CompareCitizenData(Name alias) {
        this(alias, COMPARE_CITIZEN_DATA);
    }

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

    public <O extends Record> CompareCitizenData(Table<O> path, ForeignKey<O, CompareCitizenDataRecord> childPath, InverseForeignKey<O, CompareCitizenDataRecord> parentPath) {
        super(path, childPath, parentPath, COMPARE_CITIZEN_DATA);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<CompareCitizenDataRecord> getPrimaryKey() {
        return Keys.COMPARE_CITIZEN_DATA_PKEY;
    }

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

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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