/*
 * 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.PgStatProgressCopyRecord;

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 PgStatProgressCopy extends TableImpl<PgStatProgressCopyRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>pg_catalog.pg_stat_progress_copy</code>
     */
    public static final PgStatProgressCopy PG_STAT_PROGRESS_COPY = new PgStatProgressCopy();

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

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

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

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

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

    /**
     * The column <code>pg_catalog.pg_stat_progress_copy.command</code>.
     */
    public final TableField<PgStatProgressCopyRecord, String> COMMAND = createField(DSL.name("command"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_copy.type</code>.
     */
    public final TableField<PgStatProgressCopyRecord, String> TYPE = createField(DSL.name("type"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_copy.bytes_processed</code>.
     */
    public final TableField<PgStatProgressCopyRecord, Long> BYTES_PROCESSED = createField(DSL.name("bytes_processed"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_copy.bytes_total</code>.
     */
    public final TableField<PgStatProgressCopyRecord, Long> BYTES_TOTAL = createField(DSL.name("bytes_total"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_progress_copy.tuples_processed</code>.
     */
    public final TableField<PgStatProgressCopyRecord, Long> TUPLES_PROCESSED = createField(DSL.name("tuples_processed"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_progress_copy.tuples_excluded</code>.
     */
    public final TableField<PgStatProgressCopyRecord, Long> TUPLES_EXCLUDED = createField(DSL.name("tuples_excluded"), SQLDataType.BIGINT, this, "");

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

    private PgStatProgressCopy(Name alias, Table<PgStatProgressCopyRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "pg_stat_progress_copy" as  SELECT s.pid,
         s.datid,
         d.datname,
         s.relid,
             CASE s.param5
                 WHEN 1 THEN 'COPY FROM'::text
                 WHEN 2 THEN 'COPY TO'::text
                 ELSE NULL::text
             END AS command,
             CASE s.param6
                 WHEN 1 THEN 'FILE'::text
                 WHEN 2 THEN 'PROGRAM'::text
                 WHEN 3 THEN 'PIPE'::text
                 WHEN 4 THEN 'CALLBACK'::text
                 ELSE NULL::text
             END AS type,
         s.param1 AS bytes_processed,
         s.param2 AS bytes_total,
         s.param3 AS tuples_processed,
         s.param4 AS tuples_excluded
        FROM (pg_stat_get_progress_info('COPY'::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_copy</code> table
     * reference
     */
    public PgStatProgressCopy(String alias) {
        this(DSL.name(alias), PG_STAT_PROGRESS_COPY);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_stat_progress_copy</code> table
     * reference
     */
    public PgStatProgressCopy(Name alias) {
        this(alias, PG_STAT_PROGRESS_COPY);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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