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


import com.nisemoe.generated.Public
import com.nisemoe.generated.keys.UPDATE_USER_QUEUE_PKEY
import com.nisemoe.generated.tables.records.UpdateUserQueueRecord

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

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 UpdateUserQueue(
    alias: Name,
    child: Table<out Record>?,
    path: ForeignKey<out Record, UpdateUserQueueRecord>?,
    aliased: Table<UpdateUserQueueRecord>?,
    parameters: Array<Field<*>?>?
): TableImpl<UpdateUserQueueRecord>(
    alias,
    Public.PUBLIC,
    child,
    path,
    aliased,
    parameters,
    DSL.comment(""),
    TableOptions.table()
) {
    companion object {

        /**
         * The reference instance of <code>public.update_user_queue</code>
         */
        val UPDATE_USER_QUEUE: UpdateUserQueue = UpdateUserQueue()
    }

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

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

    /**
     * The column <code>public.update_user_queue.user_id</code>.
     */
    val USER_ID: TableField<UpdateUserQueueRecord, Long?> = createField(DSL.name("user_id"), SQLDataType.BIGINT.nullable(false), this, "")

    /**
     * The column <code>public.update_user_queue.processed</code>.
     */
    val PROCESSED: TableField<UpdateUserQueueRecord, Boolean?> = createField(DSL.name("processed"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "")

    /**
     * The column <code>public.update_user_queue.created_at</code>.
     */
    val CREATED_AT: TableField<UpdateUserQueueRecord, LocalDateTime?> = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false).defaultValue(DSL.field(DSL.raw("CURRENT_TIMESTAMP"), SQLDataType.LOCALDATETIME)), this, "")

    /**
     * The column <code>public.update_user_queue.processed_at</code>.
     */
    val PROCESSED_AT: TableField<UpdateUserQueueRecord, OffsetDateTime?> = createField(DSL.name("processed_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, "")

    /**
     * The column <code>public.update_user_queue.progress_current</code>.
     */
    val PROGRESS_CURRENT: TableField<UpdateUserQueueRecord, Int?> = createField(DSL.name("progress_current"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.update_user_queue.progress_total</code>.
     */
    val PROGRESS_TOTAL: TableField<UpdateUserQueueRecord, Int?> = createField(DSL.name("progress_total"), SQLDataType.INTEGER, this, "")

    /**
     * The column <code>public.update_user_queue.added_by_user_id</code>.
     */
    val ADDED_BY_USER_ID: TableField<UpdateUserQueueRecord, Long?> = createField(DSL.name("added_by_user_id"), SQLDataType.BIGINT, this, "")

    /**
     * The column <code>public.update_user_queue.has_failed</code>.
     */
    val HAS_FAILED: TableField<UpdateUserQueueRecord, Boolean?> = createField(DSL.name("has_failed"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "")

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

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

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

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

    constructor(child: Table<out Record>, key: ForeignKey<out Record, UpdateUserQueueRecord>): this(Internal.createPathAlias(child, key), child, key, UPDATE_USER_QUEUE, null)
    override fun getSchema(): Schema? = if (aliased()) null else Public.PUBLIC
    override fun getIdentity(): Identity<UpdateUserQueueRecord, Int?> = super.getIdentity() as Identity<UpdateUserQueueRecord, Int?>
    override fun getPrimaryKey(): UniqueKey<UpdateUserQueueRecord> = UPDATE_USER_QUEUE_PKEY
    override fun `as`(alias: String): UpdateUserQueue = UpdateUserQueue(DSL.name(alias), this)
    override fun `as`(alias: Name): UpdateUserQueue = UpdateUserQueue(alias, this)
    override fun `as`(alias: Table<*>): UpdateUserQueue = UpdateUserQueue(alias.getQualifiedName(), this)

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

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

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

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

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

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