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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>ervu_dashboard.citizen_deferment_right</code>
     */
    public static final CitizenDefermentRight CITIZEN_DEFERMENT_RIGHT = new CitizenDefermentRight();

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

    /**
     * The column
     * <code>ervu_dashboard.citizen_deferment_right.citizen_deferment_right_id</code>.
     */
    public final TableField<CitizenDefermentRightRecord, Long> CITIZEN_DEFERMENT_RIGHT_ID = createField(DSL.name("citizen_deferment_right_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

    /**
     * The column <code>ervu_dashboard.citizen_deferment_right.code</code>.
     * Справочный код причины отсрочки
     */
    public final TableField<CitizenDefermentRightRecord, String> CODE = createField(DSL.name("code"), SQLDataType.VARCHAR(255).nullable(false), this, "Справочный код причины отсрочки");

    /**
     * The column <code>ervu_dashboard.citizen_deferment_right.actual</code>.
     * Признак актуальности права на отсрочку
     */
    public final TableField<CitizenDefermentRightRecord, Boolean> ACTUAL = createField(DSL.name("actual"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "Признак актуальности права на отсрочку");

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

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

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

    /**
     * Create an aliased <code>ervu_dashboard.citizen_deferment_right</code>
     * table reference
     */
    public CitizenDefermentRight(Name alias) {
        this(alias, CITIZEN_DEFERMENT_RIGHT);
    }

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

    public <O extends Record> CitizenDefermentRight(Table<O> path, ForeignKey<O, CitizenDefermentRightRecord> childPath, InverseForeignKey<O, CitizenDefermentRightRecord> parentPath) {
        super(path, childPath, parentPath, CITIZEN_DEFERMENT_RIGHT);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<CitizenDefermentRightRecord> getPrimaryKey() {
        return Keys.CITIZEN_DEFERMENT_RIGHT_PKEY;
    }

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

        return _defermentReason;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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