/*
 * This file is generated by jOOQ.
 */
package ervu_secret.ervu_secret.db_beans.pg_catalog.tables;


import ervu_secret.ervu_secret.db_beans.pg_catalog.PgCatalog;
import ervu_secret.ervu_secret.db_beans.pg_catalog.tables.records.PgStatProgressVacuumRecord;

import java.util.Collection;

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
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.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class PgStatProgressVacuum extends TableImpl<PgStatProgressVacuumRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>pg_catalog.pg_stat_progress_vacuum</code>
     */
    public static final PgStatProgressVacuum PG_STAT_PROGRESS_VACUUM = new PgStatProgressVacuum();

    /**
     * The class holding records for this type
     */
    @Override
    public Class<PgStatProgressVacuumRecord> getRecordType() {
        return PgStatProgressVacuumRecord.class;
    }

    /**
     * The column <code>pg_catalog.pg_stat_progress_vacuum.pid</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Integer> PID = createField(DSL.name("pid"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_vacuum.datid</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> DATID = createField(DSL.name("datid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_vacuum.datname</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, String> DATNAME = createField(DSL.name("datname"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_vacuum.relid</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> RELID = createField(DSL.name("relid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_vacuum.phase</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, String> PHASE = createField(DSL.name("phase"), SQLDataType.CLOB, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_progress_vacuum.heap_blks_total</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> HEAP_BLKS_TOTAL = createField(DSL.name("heap_blks_total"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_progress_vacuum.heap_blks_scanned</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> HEAP_BLKS_SCANNED = createField(DSL.name("heap_blks_scanned"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_progress_vacuum.heap_blks_vacuumed</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> HEAP_BLKS_VACUUMED = createField(DSL.name("heap_blks_vacuumed"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_progress_vacuum.index_vacuum_count</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> INDEX_VACUUM_COUNT = createField(DSL.name("index_vacuum_count"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_progress_vacuum.max_dead_tuples</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> MAX_DEAD_TUPLES = createField(DSL.name("max_dead_tuples"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_progress_vacuum.num_dead_tuples</code>.
     */
    public final TableField<PgStatProgressVacuumRecord, Long> NUM_DEAD_TUPLES = createField(DSL.name("num_dead_tuples"), SQLDataType.BIGINT, this, "");

    private PgStatProgressVacuum(Name alias, Table<PgStatProgressVacuumRecord> aliased) {
        this(alias, aliased, (Field<?>[]) null, null);
    }

    private PgStatProgressVacuum(Name alias, Table<PgStatProgressVacuumRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "pg_stat_progress_vacuum" as  SELECT s.pid,
         s.datid,
         d.datname,
         s.relid,
             CASE s.param1
                 WHEN 0 THEN 'initializing'::text
                 WHEN 1 THEN 'scanning heap'::text
                 WHEN 2 THEN 'vacuuming indexes'::text
                 WHEN 3 THEN 'vacuuming heap'::text
                 WHEN 4 THEN 'cleaning up indexes'::text
                 WHEN 5 THEN 'truncating heap'::text
                 WHEN 6 THEN 'performing final cleanup'::text
                 ELSE NULL::text
             END AS phase,
         s.param2 AS heap_blks_total,
         s.param3 AS heap_blks_scanned,
         s.param4 AS heap_blks_vacuumed,
         s.param5 AS index_vacuum_count,
         s.param6 AS max_dead_tuples,
         s.param7 AS num_dead_tuples
        FROM (pg_stat_get_progress_info('VACUUM'::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20)
          LEFT JOIN pg_database d ON ((s.datid = d.oid)));
        """), where);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_stat_progress_vacuum</code> table
     * reference
     */
    public PgStatProgressVacuum(String alias) {
        this(DSL.name(alias), PG_STAT_PROGRESS_VACUUM);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_stat_progress_vacuum</code> table
     * reference
     */
    public PgStatProgressVacuum(Name alias) {
        this(alias, PG_STAT_PROGRESS_VACUUM);
    }

    /**
     * Create a <code>pg_catalog.pg_stat_progress_vacuum</code> table reference
     */
    public PgStatProgressVacuum() {
        this(DSL.name("pg_stat_progress_vacuum"), null);
    }

    @Override
    public Schema getSchema() {
        return aliased() ? null : PgCatalog.PG_CATALOG;
    }

    @Override
    public PgStatProgressVacuum as(String alias) {
        return new PgStatProgressVacuum(DSL.name(alias), this);
    }

    @Override
    public PgStatProgressVacuum as(Name alias) {
        return new PgStatProgressVacuum(alias, this);
    }

    @Override
    public PgStatProgressVacuum as(Table<?> alias) {
        return new PgStatProgressVacuum(alias.getQualifiedName(), this);
    }

    /**
     * Rename this table
     */
    @Override
    public PgStatProgressVacuum rename(String name) {
        return new PgStatProgressVacuum(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public PgStatProgressVacuum rename(Name name) {
        return new PgStatProgressVacuum(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public PgStatProgressVacuum rename(Table<?> name) {
        return new PgStatProgressVacuum(name.getQualifiedName(), null);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgStatProgressVacuum where(Condition condition) {
        return new PgStatProgressVacuum(getQualifiedName(), aliased() ? this : null, null, condition);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgStatProgressVacuum where(Collection<? extends Condition> conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgStatProgressVacuum where(Condition... conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgStatProgressVacuum where(Field<Boolean> condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgStatProgressVacuum where(SQL condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgStatProgressVacuum where(@Stringly.SQL String condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgStatProgressVacuum where(@Stringly.SQL String condition, Object... binds) {
        return where(DSL.condition(condition, binds));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgStatProgressVacuum where(@Stringly.SQL String condition, QueryPart... parts) {
        return where(DSL.condition(condition, parts));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgStatProgressVacuum whereExists(Select<?> select) {
        return where(DSL.exists(select));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgStatProgressVacuum whereNotExists(Select<?> select) {
        return where(DSL.notExists(select));
    }
}
