/*
 * 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.CitizenForeignEducationDiploma.CitizenForeignEducationDiplomaPath;
import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.tables.records.EducationLevelRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>ervu_dashboard.education_level</code>
     */
    public static final EducationLevel EDUCATION_LEVEL = new EducationLevel();

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

    /**
     * The column
     * <code>ervu_dashboard.education_level.education_level_id</code>.
     */
    public final TableField<EducationLevelRecord, Long> EDUCATION_LEVEL_ID = createField(DSL.name("education_level_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

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

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

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

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

    /**
     * Create an aliased <code>ervu_dashboard.education_level</code> table
     * reference
     */
    public EducationLevel(Name alias) {
        this(alias, EDUCATION_LEVEL);
    }

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

    public <O extends Record> EducationLevel(Table<O> path, ForeignKey<O, EducationLevelRecord> childPath, InverseForeignKey<O, EducationLevelRecord> parentPath) {
        super(path, childPath, parentPath, EDUCATION_LEVEL);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<EducationLevelRecord> getPrimaryKey() {
        return Keys.EDUCATION_LEVEL_PKEY;
    }

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

        return _citizenEducationDiploma;
    }

    private transient CitizenForeignEducationDiplomaPath _citizenForeignEducationDiploma;

    /**
     * Get the implicit to-many join path to the
     * <code>ervu_dashboard.citizen_foreign_education_diploma</code> table
     */
    public CitizenForeignEducationDiplomaPath citizenForeignEducationDiploma() {
        if (_citizenForeignEducationDiploma == null)
            _citizenForeignEducationDiploma = new CitizenForeignEducationDiplomaPath(this, null, Keys.CITIZEN_FOREIGN_EDUCATION_DIPLOMA__CITIZEN_EDUCATION_DIPLOMA_EDUCATION_LEVEL_CODE_FK.getInverseKey());

        return _citizenForeignEducationDiploma;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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