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


import jooq.main.Public
import jooq.main.keys.VIDEO_SPEAKER_PKEY
import jooq.main.keys.VIDEO_SPEAKER__VIDEO_SPEAKER_KOTLINER_ID_FKEY
import jooq.main.keys.VIDEO_SPEAKER__VIDEO_SPEAKER_VIDEO_ID_FKEY
import jooq.main.tables.Kotliner.KotlinerPath
import jooq.main.tables.Video.VideoPath
import jooq.main.tables.records.VideoSpeakerRecord

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

        /**
         * The reference instance of <code>public.video_speaker</code>
         */
        val VIDEO_SPEAKER: VideoSpeaker = VideoSpeaker()
    }

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

    /**
     * The column <code>public.video_speaker.video_id</code>.
     */
    val VIDEO_ID: TableField<VideoSpeakerRecord, Long?> = createField(DSL.name("video_id"), SQLDataType.BIGINT.nullable(false), this, "")

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

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

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

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

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

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

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

    private lateinit var _video: VideoPath

    /**
     * Get the implicit join path to the <code>public.video</code> table.
     */
    fun video(): VideoPath {
        if (!this::_video.isInitialized)
            _video = VideoPath(this, VIDEO_SPEAKER__VIDEO_SPEAKER_VIDEO_ID_FKEY, null)

        return _video;
    }

    val video: VideoPath
        get(): VideoPath = video()

    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, VIDEO_SPEAKER__VIDEO_SPEAKER_KOTLINER_ID_FKEY, null)

        return _kotliner;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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