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

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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>pg_catalog.pg_stat_replication_slots</code>
     */
    public static final PgStatReplicationSlots PG_STAT_REPLICATION_SLOTS = new PgStatReplicationSlots();

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

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.slot_name</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, String> SLOT_NAME = createField(DSL.name("slot_name"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.spill_txns</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> SPILL_TXNS = createField(DSL.name("spill_txns"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.spill_count</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> SPILL_COUNT = createField(DSL.name("spill_count"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.spill_bytes</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> SPILL_BYTES = createField(DSL.name("spill_bytes"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.stream_txns</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> STREAM_TXNS = createField(DSL.name("stream_txns"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_replication_slots.stream_count</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> STREAM_COUNT = createField(DSL.name("stream_count"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_replication_slots.stream_bytes</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> STREAM_BYTES = createField(DSL.name("stream_bytes"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.total_txns</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> TOTAL_TXNS = createField(DSL.name("total_txns"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.total_bytes</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Long> TOTAL_BYTES = createField(DSL.name("total_bytes"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_replication_slots.stats_reset</code>.
     */
    public final TableField<PgStatReplicationSlotsRecord, Timestamp> STATS_RESET = createField(DSL.name("stats_reset"), SQLDataType.TIMESTAMP(0), this, "");

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

    private PgStatReplicationSlots(Name alias, Table<PgStatReplicationSlotsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "pg_stat_replication_slots" as  SELECT s.slot_name,
          s.spill_txns,
          s.spill_count,
          s.spill_bytes,
          s.stream_txns,
          s.stream_count,
          s.stream_bytes,
          s.total_txns,
          s.total_bytes,
          s.stats_reset
         FROM pg_replication_slots r,
          LATERAL pg_stat_get_replication_slot((r.slot_name)::text) s(slot_name, spill_txns, spill_count, spill_bytes, stream_txns, stream_count, stream_bytes, total_txns, total_bytes, stats_reset)
        WHERE (r.datoid IS NOT NULL);
        """), where);
    }

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

    /**
     * Create an aliased <code>pg_catalog.pg_stat_replication_slots</code> table
     * reference
     */
    public PgStatReplicationSlots(Name alias) {
        this(alias, PG_STAT_REPLICATION_SLOTS);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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