/*
 * This file is generated by jOOQ.
 */
package com.nisemoe.generated.tables


import com.nisemoe.generated.Public
import com.nisemoe.generated.keys.USER_SCORES_SIMILARITY_PKEY
import com.nisemoe.generated.keys.USER_SCORES_UNIQUE_BEATMAP_REPLAY_IDS
import com.nisemoe.generated.tables.records.UserScoresSimilarityRecord

import java.time.OffsetDateTime
import java.util.UUID
import java.util.function.Function

import kotlin.collections.List

import org.jooq.Field
import org.jooq.ForeignKey
import org.jooq.Identity
import org.jooq.Name
import org.jooq.Record
import org.jooq.Records
import org.jooq.Row9
import org.jooq.Schema
import org.jooq.SelectField
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 UserScoresSimilarity(
    alias: Name,
    child: Table<out Record>?,
    path: ForeignKey<out Record, UserScoresSimilarityRecord>?,
    aliased: Table<UserScoresSimilarityRecord>?,
    parameters: Array<Field<*>?>?
): TableImpl<UserScoresSimilarityRecord>(
    alias,
    Public.PUBLIC,
    child,
    path,
    aliased,
    parameters,
    DSL.comment(""),
    TableOptions.table()
) {
    companion object {

        /**
         * The reference instance of <code>public.user_scores_similarity</code>
         */
        val USER_SCORES_SIMILARITY: UserScoresSimilarity = UserScoresSimilarity()
    }

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

    /**
     * The column <code>public.user_scores_similarity.id</code>.
     */
    val ID: TableField<UserScoresSimilarityRecord, Int?> = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "")

    /**
     * The column <code>public.user_scores_similarity.beatmap_id</code>.
     */
    val BEATMAP_ID: TableField<UserScoresSimilarityRecord, Int?> = createField(DSL.name("beatmap_id"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.user_scores_similarity.replay_id_user</code>.
     */
    val REPLAY_ID_USER: TableField<UserScoresSimilarityRecord, UUID?> = createField(DSL.name("replay_id_user"), SQLDataType.UUID, this, "")

    /**
     * The column <code>public.user_scores_similarity.replay_id_osu</code>.
     */
    val REPLAY_ID_OSU: TableField<UserScoresSimilarityRecord, Long?> = createField(DSL.name("replay_id_osu"), SQLDataType.BIGINT, this, "")

    /**
     * The column <code>public.user_scores_similarity.similarity</code>.
     */
    val SIMILARITY: TableField<UserScoresSimilarityRecord, Double?> = createField(DSL.name("similarity"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.user_scores_similarity.correlation</code>.
     */
    val CORRELATION: TableField<UserScoresSimilarityRecord, Double?> = createField(DSL.name("correlation"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.user_scores_similarity.created_at</code>.
     */
    val CREATED_AT: TableField<UserScoresSimilarityRecord, OffsetDateTime?> = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).defaultValue(DSL.field(DSL.raw("CURRENT_TIMESTAMP"), SQLDataType.TIMESTAMPWITHTIMEZONE)), this, "")

    /**
     * The column <code>public.user_scores_similarity.cg_similarity</code>.
     */
    val CG_SIMILARITY: TableField<UserScoresSimilarityRecord, Double?> = createField(DSL.name("cg_similarity"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.user_scores_similarity.cg_correlation</code>.
     */
    val CG_CORRELATION: TableField<UserScoresSimilarityRecord, Double?> = createField(DSL.name("cg_correlation"), SQLDataType.DOUBLE, this, "")

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

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

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

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

    constructor(child: Table<out Record>, key: ForeignKey<out Record, UserScoresSimilarityRecord>): this(Internal.createPathAlias(child, key), child, key, USER_SCORES_SIMILARITY, null)
    override fun getSchema(): Schema? = if (aliased()) null else Public.PUBLIC
    override fun getIdentity(): Identity<UserScoresSimilarityRecord, Int?> = super.getIdentity() as Identity<UserScoresSimilarityRecord, Int?>
    override fun getPrimaryKey(): UniqueKey<UserScoresSimilarityRecord> = USER_SCORES_SIMILARITY_PKEY
    override fun getUniqueKeys(): List<UniqueKey<UserScoresSimilarityRecord>> = listOf(USER_SCORES_UNIQUE_BEATMAP_REPLAY_IDS)
    override fun `as`(alias: String): UserScoresSimilarity = UserScoresSimilarity(DSL.name(alias), this)
    override fun `as`(alias: Name): UserScoresSimilarity = UserScoresSimilarity(alias, this)
    override fun `as`(alias: Table<*>): UserScoresSimilarity = UserScoresSimilarity(alias.getQualifiedName(), this)

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

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

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

    // -------------------------------------------------------------------------
    // Row9 type methods
    // -------------------------------------------------------------------------
    override fun fieldsRow(): Row9<Int?, Int?, UUID?, Long?, Double?, Double?, OffsetDateTime?, Double?, Double?> = super.fieldsRow() as Row9<Int?, Int?, UUID?, Long?, Double?, Double?, OffsetDateTime?, Double?, Double?>

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    fun <U> mapping(from: (Int?, Int?, UUID?, Long?, Double?, Double?, OffsetDateTime?, Double?, Double?) -> U): SelectField<U> = convertFrom(Records.mapping(from))

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Class,
     * Function)}.
     */
    fun <U> mapping(toType: Class<U>, from: (Int?, Int?, UUID?, Long?, Double?, Double?, OffsetDateTime?, Double?, Double?) -> U): SelectField<U> = convertFrom(toType, Records.mapping(from))
}
