/*
 * This file is generated by jOOQ.
 */
package jooq.main.tables


import java.time.OffsetDateTime

import jooq.main.Public
import jooq.main.keys.VACANCY_PKEY
import jooq.main.keys.VACANCY__VACANCY_COMPANY_ID_FKEY
import jooq.main.keys.VACANCY__VACANCY_KOTLINER_ID_FKEY
import jooq.main.tables.Company.CompanyPath
import jooq.main.tables.Kotliner.KotlinerPath
import jooq.main.tables.records.VacancyRecord

import kotlin.collections.Collection
import kotlin.collections.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.Internal
import org.jooq.impl.SQLDataType
import org.jooq.impl.TableImpl


/**
 * This class is generated by jOOQ.
 */
@Suppress("UNCHECKED_CAST")
open class Vacancy(
    alias: Name,
    path: Table<out Record>?,
    childPath: ForeignKey<out Record, VacancyRecord>?,
    parentPath: InverseForeignKey<out Record, VacancyRecord>?,
    aliased: Table<VacancyRecord>?,
    parameters: Array<Field<*>?>?,
    where: Condition?
): TableImpl<VacancyRecord>(
    alias,
    Public.PUBLIC,
    path,
    childPath,
    parentPath,
    aliased,
    parameters,
    DSL.comment(""),
    TableOptions.table(),
    where,
) {
    companion object {

        /**
         * The reference instance of <code>public.vacancy</code>
         */
        val VACANCY: Vacancy = Vacancy()
    }

    /**
     * The class holding records for this type
     */
    override fun getRecordType(): Class<VacancyRecord> = VacancyRecord::class.java

    /**
     * The column <code>public.vacancy.id</code>.
     */
    val ID: TableField<VacancyRecord, Long?> = createField(DSL.name("id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "")

    /**
     * The column <code>public.vacancy.title</code>.
     */
    val TITLE: TableField<VacancyRecord, String?> = createField(DSL.name("title"), SQLDataType.VARCHAR(500).nullable(false), this, "")

    /**
     * The column <code>public.vacancy.location</code>.
     */
    val LOCATION: TableField<VacancyRecord, String?> = createField(DSL.name("location"), SQLDataType.VARCHAR(500).nullable(false), this, "")

    /**
     * The column <code>public.vacancy.company_id</code>.
     */
    val COMPANY_ID: TableField<VacancyRecord, Long?> = createField(DSL.name("company_id"), SQLDataType.BIGINT.nullable(false), this, "")

    /**
     * The column <code>public.vacancy.kotliner_id</code>.
     */
    val KOTLINER_ID: TableField<VacancyRecord, Long?> = createField(DSL.name("kotliner_id"), SQLDataType.BIGINT.nullable(false), this, "")

    /**
     * The column <code>public.vacancy.workplace</code>.
     */
    val WORKPLACE: TableField<VacancyRecord, String?> = createField(DSL.name("workplace"), SQLDataType.VARCHAR(500).nullable(false), this, "")

    /**
     * The column <code>public.vacancy.employment</code>.
     */
    val EMPLOYMENT: TableField<VacancyRecord, String?> = createField(DSL.name("employment"), SQLDataType.VARCHAR(500).nullable(false), this, "")

    /**
     * The column <code>public.vacancy.salary</code>.
     */
    val SALARY: TableField<VacancyRecord, String?> = createField(DSL.name("salary"), SQLDataType.VARCHAR(500).nullable(false), this, "")

    /**
     * The column <code>public.vacancy.contact</code>.
     */
    val CONTACT: TableField<VacancyRecord, String?> = createField(DSL.name("contact"), SQLDataType.VARCHAR(500).nullable(false), this, "")

    /**
     * The column <code>public.vacancy.description</code>.
     */
    val DESCRIPTION: TableField<VacancyRecord, String?> = createField(DSL.name("description"), SQLDataType.CLOB.nullable(false), this, "")

    /**
     * The column <code>public.vacancy.created</code>.
     */
    val CREATED: TableField<VacancyRecord, OffsetDateTime?> = createField(DSL.name("created"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, "")

    /**
     * The column <code>public.vacancy.updated</code>.
     */
    val UPDATED: TableField<VacancyRecord, OffsetDateTime?> = createField(DSL.name("updated"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, "")

    private constructor(alias: Name, aliased: Table<VacancyRecord>?): this(alias, null, null, null, aliased, null, null)
    private constructor(alias: Name, aliased: Table<VacancyRecord>?, parameters: Array<Field<*>?>?): this(alias, null, null, null, aliased, parameters, null)
    private constructor(alias: Name, aliased: Table<VacancyRecord>?, where: Condition?): this(alias, null, null, null, aliased, null, where)

    /**
     * Create an aliased <code>public.vacancy</code> table reference
     */
    constructor(alias: String): this(DSL.name(alias))

    /**
     * Create an aliased <code>public.vacancy</code> table reference
     */
    constructor(alias: Name): this(alias, null)

    /**
     * Create a <code>public.vacancy</code> table reference
     */
    constructor(): this(DSL.name("vacancy"), null)

    constructor(path: Table<out Record>, childPath: ForeignKey<out Record, VacancyRecord>?, parentPath: InverseForeignKey<out Record, VacancyRecord>?): this(Internal.createPathAlias(path, childPath, parentPath), path, childPath, parentPath, VACANCY, null, null)

    /**
     * A subtype implementing {@link Path} for simplified path-based joins.
     */
    open class VacancyPath : Vacancy, Path<VacancyRecord> {
        constructor(path: Table<out Record>, childPath: ForeignKey<out Record, VacancyRecord>?, parentPath: InverseForeignKey<out Record, VacancyRecord>?): super(path, childPath, parentPath)
        private constructor(alias: Name, aliased: Table<VacancyRecord>): super(alias, aliased)
        override fun `as`(alias: String): VacancyPath = VacancyPath(DSL.name(alias), this)
        override fun `as`(alias: Name): VacancyPath = VacancyPath(alias, this)
        override fun `as`(alias: Table<*>): VacancyPath = VacancyPath(alias.qualifiedName, this)
    }
    override fun getSchema(): Schema? = if (aliased()) null else Public.PUBLIC
    override fun getIdentity(): Identity<VacancyRecord, Long?> = super.getIdentity() as Identity<VacancyRecord, Long?>
    override fun getPrimaryKey(): UniqueKey<VacancyRecord> = VACANCY_PKEY
    override fun getReferences(): List<ForeignKey<VacancyRecord, *>> = listOf(VACANCY__VACANCY_COMPANY_ID_FKEY, VACANCY__VACANCY_KOTLINER_ID_FKEY)

    private lateinit var _company: CompanyPath

    /**
     * Get the implicit join path to the <code>public.company</code> table.
     */
    fun company(): CompanyPath {
        if (!this::_company.isInitialized)
            _company = CompanyPath(this, VACANCY__VACANCY_COMPANY_ID_FKEY, null)

        return _company;
    }

    val company: CompanyPath
        get(): CompanyPath = company()

    private lateinit var _kotliner: KotlinerPath

    /**
     * Get the implicit join path to the <code>public.kotliner</code> table.
     */
    fun kotliner(): KotlinerPath {
        if (!this::_kotliner.isInitialized)
            _kotliner = KotlinerPath(this, VACANCY__VACANCY_KOTLINER_ID_FKEY, null)

        return _kotliner;
    }

    val kotliner: KotlinerPath
        get(): KotlinerPath = kotliner()
    override fun `as`(alias: String): Vacancy = Vacancy(DSL.name(alias), this)
    override fun `as`(alias: Name): Vacancy = Vacancy(alias, this)
    override fun `as`(alias: Table<*>): Vacancy = Vacancy(alias.qualifiedName, this)

    /**
     * Rename this table
     */
    override fun rename(name: String): Vacancy = Vacancy(DSL.name(name), null)

    /**
     * Rename this table
     */
    override fun rename(name: Name): Vacancy = Vacancy(name, null)

    /**
     * Rename this table
     */
    override fun rename(name: Table<*>): Vacancy = Vacancy(name.qualifiedName, null)

    /**
     * Create an inline derived table from this table
     */
    override fun where(condition: Condition?): Vacancy = Vacancy(qualifiedName, if (aliased()) this else null, condition)

    /**
     * Create an inline derived table from this table
     */
    override fun where(conditions: Collection<Condition>): Vacancy = where(DSL.and(conditions))

    /**
     * Create an inline derived table from this table
     */
    override fun where(vararg conditions: Condition?): Vacancy = where(DSL.and(*conditions))

    /**
     * Create an inline derived table from this table
     */
    override fun where(condition: Field<Boolean?>?): Vacancy = where(DSL.condition(condition))

    /**
     * Create an inline derived table from this table
     */
    @PlainSQL override fun where(condition: SQL): Vacancy = where(DSL.condition(condition))

    /**
     * Create an inline derived table from this table
     */
    @PlainSQL override fun where(@Stringly.SQL condition: String): Vacancy = where(DSL.condition(condition))

    /**
     * Create an inline derived table from this table
     */
    @PlainSQL override fun where(@Stringly.SQL condition: String, vararg binds: Any?): Vacancy = where(DSL.condition(condition, *binds))

    /**
     * Create an inline derived table from this table
     */
    @PlainSQL override fun where(@Stringly.SQL condition: String, vararg parts: QueryPart): Vacancy = where(DSL.condition(condition, *parts))

    /**
     * Create an inline derived table from this table
     */
    override fun whereExists(select: Select<*>): Vacancy = where(DSL.exists(select))

    /**
     * Create an inline derived table from this table
     */
    override fun whereNotExists(select: Select<*>): Vacancy = where(DSL.notExists(select))
}
