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


import jooq.main.Public
import jooq.main.keys.ARTICLE_KOTLIN_VERSION_PKEY
import jooq.main.keys.ARTICLE_KOTLIN_VERSION__ARTICLE_KOTLIN_VERSION_ARTICLE_ID_FKEY
import jooq.main.keys.ARTICLE_KOTLIN_VERSION__ARTICLE_KOTLIN_VERSION_KOTLIN_VERSION_ID_FKEY
import jooq.main.tables.Article.ArticlePath
import jooq.main.tables.KotlinVersion.KotlinVersionPath
import jooq.main.tables.records.ArticleKotlinVersionRecord

import kotlin.collections.Collection
import kotlin.collections.List

import org.jooq.Condition
import org.jooq.Field
import org.jooq.ForeignKey
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 ArticleKotlinVersion(
    alias: Name,
    path: Table<out Record>?,
    childPath: ForeignKey<out Record, ArticleKotlinVersionRecord>?,
    parentPath: InverseForeignKey<out Record, ArticleKotlinVersionRecord>?,
    aliased: Table<ArticleKotlinVersionRecord>?,
    parameters: Array<Field<*>?>?,
    where: Condition?
): TableImpl<ArticleKotlinVersionRecord>(
    alias,
    Public.PUBLIC,
    path,
    childPath,
    parentPath,
    aliased,
    parameters,
    DSL.comment(""),
    TableOptions.table(),
    where,
) {
    companion object {

        /**
         * The reference instance of <code>public.article_kotlin_version</code>
         */
        val ARTICLE_KOTLIN_VERSION: ArticleKotlinVersion = ArticleKotlinVersion()
    }

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

    /**
     * The column <code>public.article_kotlin_version.article_id</code>.
     */
    val ARTICLE_ID: TableField<ArticleKotlinVersionRecord, Long?> = createField(DSL.name("article_id"), SQLDataType.BIGINT.nullable(false), this, "")

    /**
     * The column <code>public.article_kotlin_version.kotlin_version_id</code>.
     */
    val KOTLIN_VERSION_ID: TableField<ArticleKotlinVersionRecord, Long?> = createField(DSL.name("kotlin_version_id"), SQLDataType.BIGINT.nullable(false), this, "")

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

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

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

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

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

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

    private lateinit var _article: ArticlePath

    /**
     * Get the implicit join path to the <code>public.article</code> table.
     */
    fun article(): ArticlePath {
        if (!this::_article.isInitialized)
            _article = ArticlePath(this, ARTICLE_KOTLIN_VERSION__ARTICLE_KOTLIN_VERSION_ARTICLE_ID_FKEY, null)

        return _article;
    }

    val article: ArticlePath
        get(): ArticlePath = article()

    private lateinit var _kotlinVersion: KotlinVersionPath

    /**
     * Get the implicit join path to the <code>public.kotlin_version</code>
     * table.
     */
    fun kotlinVersion(): KotlinVersionPath {
        if (!this::_kotlinVersion.isInitialized)
            _kotlinVersion = KotlinVersionPath(this, ARTICLE_KOTLIN_VERSION__ARTICLE_KOTLIN_VERSION_KOTLIN_VERSION_ID_FKEY, null)

        return _kotlinVersion;
    }

    val kotlinVersion: KotlinVersionPath
        get(): KotlinVersionPath = kotlinVersion()
    override fun `as`(alias: String): ArticleKotlinVersion = ArticleKotlinVersion(DSL.name(alias), this)
    override fun `as`(alias: Name): ArticleKotlinVersion = ArticleKotlinVersion(alias, this)
    override fun `as`(alias: Table<*>): ArticleKotlinVersion = ArticleKotlinVersion(alias.qualifiedName, this)

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

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

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

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

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

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

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

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

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

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

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

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

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