/*
 * 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.Citizen.CitizenPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.Gender.GenderPath;
import ervu_dashboard.ervu_dashboard.db_beans.public_.tables.records.MaritalStatusRecord;

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;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>public.marital_status</code>
     */
    public static final MaritalStatus MARITAL_STATUS = new MaritalStatus();

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

    /**
     * The column <code>public.marital_status.marital_status_id</code>.
     */
    public final TableField<MaritalStatusRecord, Long> MARITAL_STATUS_ID = createField(DSL.name("marital_status_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

    /**
     * The column <code>public.marital_status.code</code>.
     */
    public final TableField<MaritalStatusRecord, String> CODE = createField(DSL.name("code"), SQLDataType.VARCHAR.nullable(false), this, "");

    /**
     * The column <code>public.marital_status.name</code>.
     */
    public final TableField<MaritalStatusRecord, String> NAME = createField(DSL.name("name"), SQLDataType.VARCHAR.nullable(false), this, "");

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

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

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

    /**
     * Create an aliased <code>public.marital_status</code> table reference
     */
    public MaritalStatus(String alias) {
        this(DSL.name(alias), MARITAL_STATUS);
    }

    /**
     * Create an aliased <code>public.marital_status</code> table reference
     */
    public MaritalStatus(Name alias) {
        this(alias, MARITAL_STATUS);
    }

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

    public <O extends Record> MaritalStatus(Table<O> path, ForeignKey<O, MaritalStatusRecord> childPath, InverseForeignKey<O, MaritalStatusRecord> parentPath) {
        super(path, childPath, parentPath, MARITAL_STATUS);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<MaritalStatusRecord> getPrimaryKey() {
        return Keys.MARITAL_STATUS_PKEY;
    }

    @Override
    public List<ForeignKey<MaritalStatusRecord, ?>> getReferences() {
        return Arrays.asList(Keys.MARITAL_STATUS__MARITAL_STATUS_FK1);
    }

    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.MARITAL_STATUS__MARITAL_STATUS_FK1, null);

        return _gender;
    }

    private transient CitizenPath _citizen;

    /**
     * Get the implicit to-many join path to the <code>public.citizen</code>
     * table
     */
    public CitizenPath citizen() {
        if (_citizen == null)
            _citizen = new CitizenPath(this, null, Keys.CITIZEN__P_CITIZEN_FK3.getInverseKey());

        return _citizen;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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