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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>ervu_dashboard.education_minprosv_doc_type</code>
     */
    public static final EducationMinprosvDocType EDUCATION_MINPROSV_DOC_TYPE = new EducationMinprosvDocType();

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

    /**
     * The column
     * <code>ervu_dashboard.education_minprosv_doc_type.education_minprosv_doc_type_id</code>.
     */
    public final TableField<EducationMinprosvDocTypeRecord, Long> EDUCATION_MINPROSV_DOC_TYPE_ID = createField(DSL.name("education_minprosv_doc_type_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

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

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

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

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

    /**
     * Create an aliased <code>ervu_dashboard.education_minprosv_doc_type</code>
     * table reference
     */
    public EducationMinprosvDocType(Name alias) {
        this(alias, EDUCATION_MINPROSV_DOC_TYPE);
    }

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

    public <O extends Record> EducationMinprosvDocType(Table<O> path, ForeignKey<O, EducationMinprosvDocTypeRecord> childPath, InverseForeignKey<O, EducationMinprosvDocTypeRecord> parentPath) {
        super(path, childPath, parentPath, EDUCATION_MINPROSV_DOC_TYPE);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<EducationMinprosvDocTypeRecord> getPrimaryKey() {
        return Keys.EDUCATION_MINPROSV_DOC_TYPE_PKEY;
    }

    @Override
    public List<UniqueKey<EducationMinprosvDocTypeRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.EDUCATION_MINPROSV_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_DOC_TYPE_CODE_MINPROSV_CODE_FK.getInverseKey());

        return _citizenEducationDiploma;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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