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


/**
 * Справочник кода страны
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class CountryOksm extends TableImpl<CountryOksmRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>ervu_dashboard.country_oksm</code>
     */
    public static final CountryOksm COUNTRY_OKSM = new CountryOksm();

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

    /**
     * The column <code>ervu_dashboard.country_oksm.country_oksm_id</code>.
     */
    public final TableField<CountryOksmRecord, Long> COUNTRY_OKSM_ID = createField(DSL.name("country_oksm_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

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

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

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

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

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

    /**
     * Create an aliased <code>ervu_dashboard.country_oksm</code> table
     * reference
     */
    public CountryOksm(Name alias) {
        this(alias, COUNTRY_OKSM);
    }

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

    public <O extends Record> CountryOksm(Table<O> path, ForeignKey<O, CountryOksmRecord> childPath, InverseForeignKey<O, CountryOksmRecord> parentPath) {
        super(path, childPath, parentPath, COUNTRY_OKSM);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<CountryOksmRecord> getPrimaryKey() {
        return Keys.COUNTRY_OKSM_PKEY;
    }

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

    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_FOREIGN_EDUCATION_DIPLOMA_COUNTRY_OKSM_CODE_FK.getInverseKey());

        return _citizenForeignEducationDiploma;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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