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


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.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.CitizenEducationDiploma.CitizenEducationDiplomaPath;
import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.tables.records.EducationMinobrDocTypeRecord;


/**
 * Справочник типа документа минобразования
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class EducationMinobrDocType extends TableImpl<EducationMinobrDocTypeRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>ervu_dashboard.education_minobr_doc_type</code>
     */
    public static final EducationMinobrDocType EDUCATION_MINOBR_DOC_TYPE = new EducationMinobrDocType();

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

    /**
     * The column
     * <code>ervu_dashboard.education_minobr_doc_type.education_minobr_doc_type_id</code>.
     */
    public final TableField<EducationMinobrDocTypeRecord, Long> EDUCATION_MINOBR_DOC_TYPE_ID = createField(DSL.name("education_minobr_doc_type_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

    /**
     * The column <code>ervu_dashboard.education_minobr_doc_type.code</code>.
     * Cправочный код
     */
    public final TableField<EducationMinobrDocTypeRecord, String> CODE = createField(DSL.name("code"), SQLDataType.VARCHAR(15).nullable(false), this, "Cправочный код");

    /**
     * The column <code>ervu_dashboard.education_minobr_doc_type.value</code>.
     * Значение
     */
    public final TableField<EducationMinobrDocTypeRecord, String> VALUE = createField(DSL.name("value"), SQLDataType.VARCHAR(255).nullable(false), this, "Значение");

    /**
     * The column
     * <code>ervu_dashboard.education_minobr_doc_type.description</code>.
     * Описание
     */
    public final TableField<EducationMinobrDocTypeRecord, String> DESCRIPTION = createField(DSL.name("description"), SQLDataType.CLOB, this, "Описание");

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

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

    private EducationMinobrDocType(Name alias, Table<EducationMinobrDocTypeRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Справочник типа документа минобразования"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>ervu_dashboard.education_minobr_doc_type</code>
     * table reference
     */
    public EducationMinobrDocType(Name alias) {
        this(alias, EDUCATION_MINOBR_DOC_TYPE);
    }

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

    public <O extends Record> EducationMinobrDocType(Table<O> path, ForeignKey<O, EducationMinobrDocTypeRecord> childPath, InverseForeignKey<O, EducationMinobrDocTypeRecord> parentPath) {
        super(path, childPath, parentPath, EDUCATION_MINOBR_DOC_TYPE);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<EducationMinobrDocTypeRecord> getPrimaryKey() {
        return Keys.EDUCATION_MINOBR_DOC_TYPE_PKEY;
    }

    @Override
    public List<UniqueKey<EducationMinobrDocTypeRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.EDUCATION_MINOBR_DOC_TYPE_CODE_UNIQUE_KEY);
    }

    private transient CitizenEducationDiplomaPath _citizenEducationDiploma;

    /**
     * Get the implicit to-many join path to the
     * <code>ervu_dashboard.citizen_education_diploma</code> table
     */
    public CitizenEducationDiplomaPath citizenEducationDiploma() {
        if (_citizenEducationDiploma == null)
            _citizenEducationDiploma = new CitizenEducationDiplomaPath(this, null, Keys.CITIZEN_EDUCATION_DIPLOMA__CITIZEN_EDUCATION_DIPLOMA_MINOBR_DOC_TYPE_CODE_FK.getInverseKey());

        return _citizenEducationDiploma;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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