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


import java.sql.Timestamp;
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.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.ervu_dashboard.db_beans.ervu_dashboard.ErvuDashboard;
import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.Keys;
import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.tables.DefermentReason.DefermentReasonPath;
import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.tables.records.CitizenDefermentRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>ervu_dashboard.citizen_deferment</code>
     */
    public static final CitizenDeferment CITIZEN_DEFERMENT = new CitizenDeferment();

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

    /**
     * The column
     * <code>ervu_dashboard.citizen_deferment.citizen_deferment_id</code>.
     */
    public final TableField<CitizenDefermentRecord, Long> CITIZEN_DEFERMENT_ID = createField(DSL.name("citizen_deferment_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

    /**
     * The column <code>ervu_dashboard.citizen_deferment.recruit_id</code>.
     */
    public final TableField<CitizenDefermentRecord, UUID> RECRUIT_ID = createField(DSL.name("recruit_id"), SQLDataType.UUID.nullable(false), this, "");

    /**
     * The column <code>ervu_dashboard.citizen_deferment.decision_number</code>.
     * Номер решения
     */
    public final TableField<CitizenDefermentRecord, String> DECISION_NUMBER = createField(DSL.name("decision_number"), SQLDataType.VARCHAR, this, "Номер решения");

    /**
     * The column <code>ervu_dashboard.citizen_deferment.type</code>.
     */
    public final TableField<CitizenDefermentRecord, String> TYPE = createField(DSL.name("type"), SQLDataType.CLOB.nullable(false), this, "");

    /**
     * The column <code>ervu_dashboard.citizen_deferment.start_date</code>. Дата
     * начала действия отсрочки/освобождения
     */
    public final TableField<CitizenDefermentRecord, Timestamp> START_DATE = createField(DSL.name("start_date"), SQLDataType.TIMESTAMP(0).nullable(false), this, "Дата начала действия отсрочки/освобождения");

    /**
     * The column <code>ervu_dashboard.citizen_deferment.end_date</code>. Дата
     * окончания действия отсрочки/освобождения
     */
    public final TableField<CitizenDefermentRecord, Timestamp> END_DATE = createField(DSL.name("end_date"), SQLDataType.TIMESTAMP(0), this, "Дата окончания действия отсрочки/освобождения");

    /**
     * The column <code>ervu_dashboard.citizen_deferment.reason_code</code>.
     * Справочный код причины отсрочки/освобождения
     */
    public final TableField<CitizenDefermentRecord, String> REASON_CODE = createField(DSL.name("reason_code"), SQLDataType.VARCHAR.nullable(false), this, "Справочный код причины отсрочки/освобождения");

    /**
     * The column <code>ervu_dashboard.citizen_deferment.active</code>. Признак
     * активности отсрочки/освобождения
     */
    public final TableField<CitizenDefermentRecord, Boolean> ACTIVE = createField(DSL.name("active"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "Признак активности отсрочки/освобождения");

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

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

    /**
     * Create an aliased <code>ervu_dashboard.citizen_deferment</code> table
     * reference
     */
    public CitizenDeferment(String alias) {
        this(DSL.name(alias), CITIZEN_DEFERMENT);
    }

    /**
     * Create an aliased <code>ervu_dashboard.citizen_deferment</code> table
     * reference
     */
    public CitizenDeferment(Name alias) {
        this(alias, CITIZEN_DEFERMENT);
    }

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

    public <O extends Record> CitizenDeferment(Table<O> path, ForeignKey<O, CitizenDefermentRecord> childPath, InverseForeignKey<O, CitizenDefermentRecord> parentPath) {
        super(path, childPath, parentPath, CITIZEN_DEFERMENT);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<CitizenDefermentRecord> getPrimaryKey() {
        return Keys.CITIZEN_DEFERMENT_PKEY;
    }

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

    private transient DefermentReasonPath _defermentReason;

    /**
     * Get the implicit join path to the
     * <code>ervu_dashboard.deferment_reason</code> table.
     */
    public DefermentReasonPath defermentReason() {
        if (_defermentReason == null)
            _defermentReason = new DefermentReasonPath(this, Keys.CITIZEN_DEFERMENT__CITIZEN_DEFERMENT_DEFERMENT_REASON_CODE_FK, null);

        return _defermentReason;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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