/*
 * This file is generated by jOOQ.
 */
package ervu_dashboard.ervu_dashboard.db_beans.public_.tables;


import ervu_dashboard.ervu_dashboard.db_beans.public_.Keys;
import ervu_dashboard.ervu_dashboard.db_beans.public_.Public;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.Education.EducationPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.Employment.EmploymentPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.Gender.GenderPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.MaritalStatus.MaritalStatusPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.PubRecruitment.PubRecruitmentPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.ReasonRegistration.ReasonRegistrationPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.records.CitizenRecord;

import java.sql.Date;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.UUID;

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.ForeignKey;
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;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>public.citizen</code>
     */
    public static final Citizen CITIZEN = new Citizen();

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

    /**
     * The column <code>public.citizen.id_ERN</code>.
     */
    public final TableField<CitizenRecord, String> ID_ERN = createField(DSL.name("id_ERN"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>public.citizen.fio</code>.
     */
    public final TableField<CitizenRecord, String> FIO = createField(DSL.name("fio"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>public.citizen.residence</code>.
     */
    public final TableField<CitizenRecord, String> RESIDENCE = createField(DSL.name("residence"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>public.citizen.age</code>.
     */
    public final TableField<CitizenRecord, String> AGE = createField(DSL.name("age"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>public.citizen.recruitment</code>.
     */
    public final TableField<CitizenRecord, String> RECRUITMENT = createField(DSL.name("recruitment"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>public.citizen.recruitment_id</code>.
     */
    public final TableField<CitizenRecord, UUID> RECRUITMENT_ID = createField(DSL.name("recruitment_id"), SQLDataType.UUID, this, "");

    /**
     * The column <code>public.citizen.gender_id</code>.
     */
    public final TableField<CitizenRecord, Long> GENDER_ID = createField(DSL.name("gender_id"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>public.citizen.marital_status_id</code>.
     */
    public final TableField<CitizenRecord, Long> MARITAL_STATUS_ID = createField(DSL.name("marital_status_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>public.citizen.education_id</code>.
     */
    public final TableField<CitizenRecord, Long> EDUCATION_ID = createField(DSL.name("education_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>public.citizen.employment_id</code>.
     */
    public final TableField<CitizenRecord, Long> EMPLOYMENT_ID = createField(DSL.name("employment_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>public.citizen.urgent_service</code>.
     */
    public final TableField<CitizenRecord, Boolean> URGENT_SERVICE = createField(DSL.name("urgent_service"), SQLDataType.BOOLEAN.defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>public.citizen.contract_service</code>.
     */
    public final TableField<CitizenRecord, Boolean> CONTRACT_SERVICE = createField(DSL.name("contract_service"), SQLDataType.BOOLEAN.defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>public.citizen.mobilization</code>.
     */
    public final TableField<CitizenRecord, Boolean> MOBILIZATION = createField(DSL.name("mobilization"), SQLDataType.BOOLEAN.defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>public.citizen.is_registered</code>.
     */
    public final TableField<CitizenRecord, Boolean> IS_REGISTERED = createField(DSL.name("is_registered"), SQLDataType.BOOLEAN.defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>public.citizen.reason_registration_id</code>.
     */
    public final TableField<CitizenRecord, Integer> REASON_REGISTRATION_ID = createField(DSL.name("reason_registration_id"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>public.citizen.issue_date</code>.
     */
    public final TableField<CitizenRecord, Date> ISSUE_DATE = createField(DSL.name("issue_date"), SQLDataType.DATE, this, "");

    /**
     * The column <code>public.citizen.passport_series</code>.
     */
    public final TableField<CitizenRecord, String> PASSPORT_SERIES = createField(DSL.name("passport_series"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>public.citizen.passport_number</code>.
     */
    public final TableField<CitizenRecord, String> PASSPORT_NUMBER = createField(DSL.name("passport_number"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>public.citizen.number_children</code>.
     */
    public final TableField<CitizenRecord, Integer> NUMBER_CHILDREN = createField(DSL.name("number_children"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>public.citizen.phone</code>.
     */
    public final TableField<CitizenRecord, String> PHONE = createField(DSL.name("phone"), SQLDataType.VARCHAR, this, "");

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

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

    /**
     * Create an aliased <code>public.citizen</code> table reference
     */
    public Citizen(String alias) {
        this(DSL.name(alias), CITIZEN);
    }

    /**
     * Create an aliased <code>public.citizen</code> table reference
     */
    public Citizen(Name alias) {
        this(alias, CITIZEN);
    }

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

    public <O extends Record> Citizen(Table<O> path, ForeignKey<O, CitizenRecord> childPath, InverseForeignKey<O, CitizenRecord> parentPath) {
        super(path, childPath, parentPath, CITIZEN);
    }

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

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

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

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

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

    @Override
    public UniqueKey<CitizenRecord> getPrimaryKey() {
        return Keys.CITIZEN_PKEY;
    }

    @Override
    public List<ForeignKey<CitizenRecord, ?>> getReferences() {
        return Arrays.asList(Keys.CITIZEN__P_CITIZEN_FK1, Keys.CITIZEN__P_CITIZEN_FK2, Keys.CITIZEN__P_CITIZEN_FK3, Keys.CITIZEN__P_CITIZEN_FK5, Keys.CITIZEN__P_CITIZEN_FK4, Keys.CITIZEN__P_CITIZEN_FK6);
    }

    private transient PubRecruitmentPath _pubRecruitment;

    /**
     * Get the implicit join path to the <code>public.pub_recruitment</code>
     * table.
     */
    public PubRecruitmentPath pubRecruitment() {
        if (_pubRecruitment == null)
            _pubRecruitment = new PubRecruitmentPath(this, Keys.CITIZEN__P_CITIZEN_FK1, null);

        return _pubRecruitment;
    }

    private transient GenderPath _gender;

    /**
     * Get the implicit join path to the <code>public.gender</code> table.
     */
    public GenderPath gender() {
        if (_gender == null)
            _gender = new GenderPath(this, Keys.CITIZEN__P_CITIZEN_FK2, null);

        return _gender;
    }

    private transient MaritalStatusPath _maritalStatus;

    /**
     * Get the implicit join path to the <code>public.marital_status</code>
     * table.
     */
    public MaritalStatusPath maritalStatus() {
        if (_maritalStatus == null)
            _maritalStatus = new MaritalStatusPath(this, Keys.CITIZEN__P_CITIZEN_FK3, null);

        return _maritalStatus;
    }

    private transient EducationPath _education;

    /**
     * Get the implicit join path to the <code>public.education</code> table.
     */
    public EducationPath education() {
        if (_education == null)
            _education = new EducationPath(this, Keys.CITIZEN__P_CITIZEN_FK5, null);

        return _education;
    }

    private transient EmploymentPath _employment;

    /**
     * Get the implicit join path to the <code>public.employment</code> table.
     */
    public EmploymentPath employment() {
        if (_employment == null)
            _employment = new EmploymentPath(this, Keys.CITIZEN__P_CITIZEN_FK4, null);

        return _employment;
    }

    private transient ReasonRegistrationPath _reasonRegistration;

    /**
     * Get the implicit join path to the <code>public.reason_registration</code>
     * table.
     */
    public ReasonRegistrationPath reasonRegistration() {
        if (_reasonRegistration == null)
            _reasonRegistration = new ReasonRegistrationPath(this, Keys.CITIZEN__P_CITIZEN_FK6, null);

        return _reasonRegistration;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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