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


import com.nisemoe.generated.Public
import com.nisemoe.generated.keys.BEATMAPS_PKEY
import com.nisemoe.generated.tables.records.BeatmapsRecord

import java.time.OffsetDateTime

import kotlin.collections.Collection

import org.jooq.Condition
import org.jooq.Field
import org.jooq.ForeignKey
import org.jooq.InverseForeignKey
import org.jooq.Name
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.SQLDataType
import org.jooq.impl.TableImpl


/**
 * This class is generated by jOOQ.
 */
@Suppress("UNCHECKED_CAST")
open class Beatmaps(
    alias: Name,
    path: Table<out Record>?,
    childPath: ForeignKey<out Record, BeatmapsRecord>?,
    parentPath: InverseForeignKey<out Record, BeatmapsRecord>?,
    aliased: Table<BeatmapsRecord>?,
    parameters: Array<Field<*>?>?,
    where: Condition?
): TableImpl<BeatmapsRecord>(
    alias,
    Public.PUBLIC,
    path,
    childPath,
    parentPath,
    aliased,
    parameters,
    DSL.comment(""),
    TableOptions.table(),
    where,
) {
    companion object {

        /**
         * The reference instance of <code>public.beatmaps</code>
         */
        val BEATMAPS: Beatmaps = Beatmaps()
    }

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

    /**
     * The column <code>public.beatmaps.beatmap_id</code>.
     */
    val BEATMAP_ID: TableField<BeatmapsRecord, Int?> = createField(DSL.name("beatmap_id"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("nextval('beatmaps_beatmap_id_seq1'::regclass)"), SQLDataType.INTEGER)), this, "")

    /**
     * The column <code>public.beatmaps.artist</code>.
     */
    val ARTIST: TableField<BeatmapsRecord, String?> = createField(DSL.name("artist"), SQLDataType.VARCHAR, this, "")

    /**
     * The column <code>public.beatmaps.beatmapset_id</code>.
     */
    val BEATMAPSET_ID: TableField<BeatmapsRecord, Int?> = createField(DSL.name("beatmapset_id"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.beatmaps.creator</code>.
     */
    val CREATOR: TableField<BeatmapsRecord, String?> = createField(DSL.name("creator"), SQLDataType.VARCHAR, this, "")

    /**
     * The column <code>public.beatmaps.source</code>.
     */
    val SOURCE: TableField<BeatmapsRecord, String?> = createField(DSL.name("source"), SQLDataType.VARCHAR, this, "")

    /**
     * The column <code>public.beatmaps.star_rating</code>.
     */
    val STAR_RATING: TableField<BeatmapsRecord, Double?> = createField(DSL.name("star_rating"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.beatmaps.title</code>.
     */
    val TITLE: TableField<BeatmapsRecord, String?> = createField(DSL.name("title"), SQLDataType.VARCHAR, this, "")

    /**
     * The column <code>public.beatmaps.version</code>.
     */
    val VERSION: TableField<BeatmapsRecord, String?> = createField(DSL.name("version"), SQLDataType.VARCHAR, this, "")

    /**
     * The column <code>public.beatmaps.sys_last_update</code>.
     */
    val SYS_LAST_UPDATE: TableField<BeatmapsRecord, OffsetDateTime?> = createField(DSL.name("sys_last_update"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).defaultValue(DSL.field(DSL.raw("CURRENT_TIMESTAMP"), SQLDataType.TIMESTAMPWITHTIMEZONE)), this, "")

    /**
     * The column <code>public.beatmaps.last_replay_check</code>.
     */
    val LAST_REPLAY_CHECK: TableField<BeatmapsRecord, String?> = createField(DSL.name("last_replay_check"), SQLDataType.CLOB, this, "")

    /**
     * The column <code>public.beatmaps.beatmap_file</code>.
     */
    val BEATMAP_FILE: TableField<BeatmapsRecord, String?> = createField(DSL.name("beatmap_file"), SQLDataType.CLOB, this, "")

    /**
     * The column <code>public.beatmaps.beatmap_hash</code>.
     */
    val BEATMAP_HASH: TableField<BeatmapsRecord, String?> = createField(DSL.name("beatmap_hash"), SQLDataType.VARCHAR(32), this, "")

    /**
     * The column <code>public.beatmaps.total_length</code>.
     */
    val TOTAL_LENGTH: TableField<BeatmapsRecord, Int?> = createField(DSL.name("total_length"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.beatmaps.bpm</code>.
     */
    val BPM: TableField<BeatmapsRecord, Double?> = createField(DSL.name("bpm"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.beatmaps.accuracy</code>.
     */
    val ACCURACY: TableField<BeatmapsRecord, Double?> = createField(DSL.name("accuracy"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.beatmaps.ar</code>.
     */
    val AR: TableField<BeatmapsRecord, Double?> = createField(DSL.name("ar"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.beatmaps.cs</code>.
     */
    val CS: TableField<BeatmapsRecord, Double?> = createField(DSL.name("cs"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.beatmaps.drain</code>.
     */
    val DRAIN: TableField<BeatmapsRecord, Double?> = createField(DSL.name("drain"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.beatmaps.count_circles</code>.
     */
    val COUNT_CIRCLES: TableField<BeatmapsRecord, Int?> = createField(DSL.name("count_circles"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.beatmaps.count_sliders</code>.
     */
    val COUNT_SLIDERS: TableField<BeatmapsRecord, Int?> = createField(DSL.name("count_sliders"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.beatmaps.count_spinners</code>.
     */
    val COUNT_SPINNERS: TableField<BeatmapsRecord, Int?> = createField(DSL.name("count_spinners"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.beatmaps.max_combo</code>.
     */
    val MAX_COMBO: TableField<BeatmapsRecord, Int?> = createField(DSL.name("max_combo"), SQLDataType.INTEGER, this, "")

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

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

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

    /**
     * Create a <code>public.beatmaps</code> table reference
     */
    constructor(): this(DSL.name("beatmaps"), null)
    override fun getSchema(): Schema? = if (aliased()) null else Public.PUBLIC
    override fun getPrimaryKey(): UniqueKey<BeatmapsRecord> = BEATMAPS_PKEY
    override fun `as`(alias: String): Beatmaps = Beatmaps(DSL.name(alias), this)
    override fun `as`(alias: Name): Beatmaps = Beatmaps(alias, this)
    override fun `as`(alias: Table<*>): Beatmaps = Beatmaps(alias.qualifiedName, this)

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

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

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

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

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

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

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

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

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

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

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

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

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