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


import com.nisemoe.generated.Public
import com.nisemoe.generated.enums.JudgementType
import com.nisemoe.generated.indexes.IDX_SCORES_JUDGEMENTS_SCORE_ID
import com.nisemoe.generated.keys.SCORES_JUDGEMENTS_PKEY
import com.nisemoe.generated.keys.SCORES_JUDGEMENTS__SCORES_JUDGEMENTS_SCORE_ID_FKEY
import com.nisemoe.generated.tables.Scores.ScoresPath
import com.nisemoe.generated.tables.records.ScoresJudgementsRecord

import kotlin.collections.Collection
import kotlin.collections.List

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

        /**
         * The reference instance of <code>public.scores_judgements</code>
         */
        val SCORES_JUDGEMENTS: ScoresJudgements = ScoresJudgements()
    }

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

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

    /**
     * The column <code>public.scores_judgements.time</code>.
     */
    val TIME: TableField<ScoresJudgementsRecord, Double?> = createField(DSL.name("time"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.scores_judgements.x</code>.
     */
    val X: TableField<ScoresJudgementsRecord, Double?> = createField(DSL.name("x"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.scores_judgements.y</code>.
     */
    val Y: TableField<ScoresJudgementsRecord, Double?> = createField(DSL.name("y"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.scores_judgements.type</code>.
     */
    val TYPE: TableField<ScoresJudgementsRecord, JudgementType?> = createField(DSL.name("type"), SQLDataType.VARCHAR.asEnumDataType(JudgementType::class.java), this, "")

    /**
     * The column <code>public.scores_judgements.distance_center</code>.
     */
    val DISTANCE_CENTER: TableField<ScoresJudgementsRecord, Double?> = createField(DSL.name("distance_center"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.scores_judgements.distance_edge</code>.
     */
    val DISTANCE_EDGE: TableField<ScoresJudgementsRecord, Double?> = createField(DSL.name("distance_edge"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.scores_judgements.error</code>.
     */
    val ERROR: TableField<ScoresJudgementsRecord, Double?> = createField(DSL.name("error"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.scores_judgements.score_id</code>.
     */
    val SCORE_ID: TableField<ScoresJudgementsRecord, Int?> = createField(DSL.name("score_id"), SQLDataType.INTEGER, this, "")

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

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

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

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

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

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

    private lateinit var _scores: ScoresPath

    /**
     * Get the implicit join path to the <code>public.scores</code> table.
     */
    fun scores(): ScoresPath {
        if (!this::_scores.isInitialized)
            _scores = ScoresPath(this, SCORES_JUDGEMENTS__SCORES_JUDGEMENTS_SCORE_ID_FKEY, null)

        return _scores;
    }

    val scores: ScoresPath
        get(): ScoresPath = scores()
    override fun `as`(alias: String): ScoresJudgements = ScoresJudgements(DSL.name(alias), this)
    override fun `as`(alias: Name): ScoresJudgements = ScoresJudgements(alias, this)
    override fun `as`(alias: Table<*>): ScoresJudgements = ScoresJudgements(alias.qualifiedName, this)

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

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

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

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

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

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

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

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

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

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

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

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

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