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


import com.nisemoe.generated.Public
import com.nisemoe.generated.keys.REDDIT_POST_PKEY
import com.nisemoe.generated.tables.records.RedditPostRecord

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

        /**
         * The reference instance of <code>public.reddit_post</code>
         */
        val REDDIT_POST: RedditPost = RedditPost()
    }

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

    /**
     * The column <code>public.reddit_post.post_id</code>.
     */
    val POST_ID: TableField<RedditPostRecord, String?> = createField(DSL.name("post_id"), SQLDataType.VARCHAR.nullable(false), this, "")

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

    /**
     * The column <code>public.reddit_post.created_utc</code>.
     */
    val CREATED_UTC: TableField<RedditPostRecord, Double?> = createField(DSL.name("created_utc"), SQLDataType.DOUBLE, this, "")

    /**
     * The column <code>public.reddit_post.url</code>.
     */
    val URL: TableField<RedditPostRecord, String?> = createField(DSL.name("url"), SQLDataType.VARCHAR, this, "")

    /**
     * The column <code>public.reddit_post.is_checked</code>.
     */
    val IS_CHECKED: TableField<RedditPostRecord, Boolean?> = createField(DSL.name("is_checked"), SQLDataType.BOOLEAN.defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "")

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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