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

import java.sql.Timestamp;
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.DefaultDataType;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>pg_catalog.pg_stat_activity</code>
     */
    public static final PgStatActivity PG_STAT_ACTIVITY = new PgStatActivity();

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

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

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

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

    /**
     * The column <code>pg_catalog.pg_stat_activity.leader_pid</code>.
     */
    public final TableField<PgStatActivityRecord, Integer> LEADER_PID = createField(DSL.name("leader_pid"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.usesysid</code>.
     */
    public final TableField<PgStatActivityRecord, Long> USESYSID = createField(DSL.name("usesysid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.usename</code>.
     */
    public final TableField<PgStatActivityRecord, String> USENAME = createField(DSL.name("usename"), SQLDataType.VARCHAR, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.application_name</code>.
     */
    public final TableField<PgStatActivityRecord, String> APPLICATION_NAME = createField(DSL.name("application_name"), SQLDataType.CLOB, this, "");

    /**
     * @deprecated Unknown data type. If this is a qualified, user-defined type,
     * it may have been excluded from code generation. If this is a built-in
     * type, you can define an explicit {@link org.jooq.Binding} to specify how
     * this type should be handled. Deprecation can be turned off using
     * {@literal <deprecationOnUnknownTypes/>} in your code generator
     * configuration.
     */
    @Deprecated
    public final TableField<PgStatActivityRecord, Object> CLIENT_ADDR = createField(DSL.name("client_addr"), DefaultDataType.getDefaultDataType("\"pg_catalog\".\"inet\""), this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.client_hostname</code>.
     */
    public final TableField<PgStatActivityRecord, String> CLIENT_HOSTNAME = createField(DSL.name("client_hostname"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.client_port</code>.
     */
    public final TableField<PgStatActivityRecord, Integer> CLIENT_PORT = createField(DSL.name("client_port"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.backend_start</code>.
     */
    public final TableField<PgStatActivityRecord, Timestamp> BACKEND_START = createField(DSL.name("backend_start"), SQLDataType.TIMESTAMP(0), this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.xact_start</code>.
     */
    public final TableField<PgStatActivityRecord, Timestamp> XACT_START = createField(DSL.name("xact_start"), SQLDataType.TIMESTAMP(0), this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.query_start</code>.
     */
    public final TableField<PgStatActivityRecord, Timestamp> QUERY_START = createField(DSL.name("query_start"), SQLDataType.TIMESTAMP(0), this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.state_change</code>.
     */
    public final TableField<PgStatActivityRecord, Timestamp> STATE_CHANGE = createField(DSL.name("state_change"), SQLDataType.TIMESTAMP(0), this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.wait_event_type</code>.
     */
    public final TableField<PgStatActivityRecord, String> WAIT_EVENT_TYPE = createField(DSL.name("wait_event_type"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.wait_event</code>.
     */
    public final TableField<PgStatActivityRecord, String> WAIT_EVENT = createField(DSL.name("wait_event"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.state</code>.
     */
    public final TableField<PgStatActivityRecord, String> STATE = createField(DSL.name("state"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.backend_xid</code>.
     */
    public final TableField<PgStatActivityRecord, Long> BACKEND_XID = createField(DSL.name("backend_xid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.backend_xmin</code>.
     */
    public final TableField<PgStatActivityRecord, Long> BACKEND_XMIN = createField(DSL.name("backend_xmin"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.query_id</code>.
     */
    public final TableField<PgStatActivityRecord, Long> QUERY_ID = createField(DSL.name("query_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.query</code>.
     */
    public final TableField<PgStatActivityRecord, String> QUERY = createField(DSL.name("query"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_activity.backend_type</code>.
     */
    public final TableField<PgStatActivityRecord, String> BACKEND_TYPE = createField(DSL.name("backend_type"), SQLDataType.CLOB, this, "");

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

    private PgStatActivity(Name alias, Table<PgStatActivityRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "pg_stat_activity" as  SELECT s.datid,
         d.datname,
         s.pid,
         s.leader_pid,
         s.usesysid,
         u.rolname AS usename,
         s.application_name,
         s.client_addr,
         s.client_hostname,
         s.client_port,
         s.backend_start,
         s.xact_start,
         s.query_start,
         s.state_change,
         s.wait_event_type,
         s.wait_event,
         s.state,
         s.backend_xid,
         s.backend_xmin,
         s.query_id,
         s.query,
         s.backend_type
        FROM ((pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, leader_pid, query_id)
          LEFT JOIN pg_database d ON ((s.datid = d.oid)))
          LEFT JOIN pg_authid u ON ((s.usesysid = u.oid)));
        """), where);
    }

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

    /**
     * Create an aliased <code>pg_catalog.pg_stat_activity</code> table
     * reference
     */
    public PgStatActivity(Name alias) {
        this(alias, PG_STAT_ACTIVITY);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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