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


import com.nisemoe.generated.Public
import com.nisemoe.generated.indexes.IDX_REPLAY_IDS
import com.nisemoe.generated.indexes.IDX_REPLAY_IDS_PAIRS
import com.nisemoe.generated.keys.SCORES_SIMILARITY_PKEY
import com.nisemoe.generated.keys.UNIQUE_BEATMAP_REPLAY_IDS
import com.nisemoe.generated.tables.records.ScoresSimilarityRecord

import java.time.LocalDateTime
import java.util.function.Function

import kotlin.collections.List

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

        /**
         * The reference instance of <code>public.scores_similarity</code>
         */
        val SCORES_SIMILARITY: ScoresSimilarity = ScoresSimilarity()
    }

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

    /**
     * The column <code>public.scores_similarity.id</code>.
     */
    val ID: TableField<ScoresSimilarityRecord, Int?> = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("nextval('scores_similarity_id_seq1'::regclass)"), SQLDataType.INTEGER)), this, "")

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

    /**
     * The column <code>public.scores_similarity.replay_id_1</code>.
     */
    val REPLAY_ID_1: TableField<ScoresSimilarityRecord, Long?> = createField(DSL.name("replay_id_1"), SQLDataType.BIGINT, this, "")

    /**
     * The column <code>public.scores_similarity.replay_id_2</code>.
     */
    val REPLAY_ID_2: TableField<ScoresSimilarityRecord, Long?> = createField(DSL.name("replay_id_2"), SQLDataType.BIGINT, this, "")

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

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

    /**
     * The column <code>public.scores_similarity.created_at</code>.
     */
    val CREATED_AT: TableField<ScoresSimilarityRecord, LocalDateTime?> = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6), this, "")

    /**
     * The column
     * <code>public.scores_similarity.sent_discord_notification</code>.
     */
    val SENT_DISCORD_NOTIFICATION: TableField<ScoresSimilarityRecord, Boolean?> = createField(DSL.name("sent_discord_notification"), SQLDataType.BOOLEAN, this, "")

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

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

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

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

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

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

    constructor(child: Table<out Record>, key: ForeignKey<out Record, ScoresSimilarityRecord>): this(Internal.createPathAlias(child, key), child, key, SCORES_SIMILARITY, null)
    override fun getSchema(): Schema? = if (aliased()) null else Public.PUBLIC
    override fun getIndexes(): List<Index> = listOf(IDX_REPLAY_IDS, IDX_REPLAY_IDS_PAIRS)
    override fun getPrimaryKey(): UniqueKey<ScoresSimilarityRecord> = SCORES_SIMILARITY_PKEY
    override fun getUniqueKeys(): List<UniqueKey<ScoresSimilarityRecord>> = listOf(UNIQUE_BEATMAP_REPLAY_IDS)
    override fun `as`(alias: String): ScoresSimilarity = ScoresSimilarity(DSL.name(alias), this)
    override fun `as`(alias: Name): ScoresSimilarity = ScoresSimilarity(alias, this)
    override fun `as`(alias: Table<*>): ScoresSimilarity = ScoresSimilarity(alias.getQualifiedName(), this)

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

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

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

    // -------------------------------------------------------------------------
    // Row10 type methods
    // -------------------------------------------------------------------------
    override fun fieldsRow(): Row10<Int?, Int?, Long?, Long?, Double?, Double?, LocalDateTime?, Boolean?, Double?, Double?> = super.fieldsRow() as Row10<Int?, Int?, Long?, Long?, Double?, Double?, LocalDateTime?, Boolean?, Double?, Double?>

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    fun <U> mapping(from: (Int?, Int?, Long?, Long?, Double?, Double?, LocalDateTime?, Boolean?, 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?, Long?, Long?, Double?, Double?, LocalDateTime?, Boolean?, Double?, Double?) -> U): SelectField<U> = convertFrom(toType, Records.mapping(from))
}
