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


import java.time.OffsetDateTime

import jooq.main.Public
import jooq.main.keys.LIBRARY_VERSION_PKEY
import jooq.main.keys.LIBRARY_VERSION__LIBRARY_VERSION_LIBRARY_ID_FKEY
import jooq.main.tables.Library.LibraryPath
import jooq.main.tables.records.LibraryVersionRecord

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

        /**
         * The reference instance of <code>public.library_version</code>
         */
        val LIBRARY_VERSION: LibraryVersion = LibraryVersion()
    }

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

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

    /**
     * The column <code>public.library_version.library_id</code>.
     */
    val LIBRARY_ID: TableField<LibraryVersionRecord, Long?> = createField(DSL.name("library_id"), SQLDataType.BIGINT.nullable(false), this, "")

    /**
     * The column <code>public.library_version.group_id</code>.
     */
    val GROUP_ID: TableField<LibraryVersionRecord, String?> = createField(DSL.name("group_id"), SQLDataType.VARCHAR(1000).nullable(false), this, "")

    /**
     * The column <code>public.library_version.artifact_id</code>.
     */
    val ARTIFACT_ID: TableField<LibraryVersionRecord, String?> = createField(DSL.name("artifact_id"), SQLDataType.VARCHAR(1000).nullable(false), this, "")

    /**
     * The column <code>public.library_version.version</code>.
     */
    val VERSION: TableField<LibraryVersionRecord, String?> = createField(DSL.name("version"), SQLDataType.VARCHAR(100).nullable(false), this, "")

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

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

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

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

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

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

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

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

    private lateinit var _library: LibraryPath

    /**
     * Get the implicit join path to the <code>public.library</code> table.
     */
    fun library(): LibraryPath {
        if (!this::_library.isInitialized)
            _library = LibraryPath(this, LIBRARY_VERSION__LIBRARY_VERSION_LIBRARY_ID_FKEY, null)

        return _library;
    }

    val library: LibraryPath
        get(): LibraryPath = library()
    override fun `as`(alias: String): LibraryVersion = LibraryVersion(DSL.name(alias), this)
    override fun `as`(alias: Name): LibraryVersion = LibraryVersion(alias, this)
    override fun `as`(alias: Table<*>): LibraryVersion = LibraryVersion(alias.qualifiedName, this)

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

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

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

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

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

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

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

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

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

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

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

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

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