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

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 PgStatSubscriptionStats extends TableImpl<PgStatSubscriptionStatsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>pg_catalog.pg_stat_subscription_stats</code>
     */
    public static final PgStatSubscriptionStats PG_STAT_SUBSCRIPTION_STATS = new PgStatSubscriptionStats();

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

    /**
     * The column <code>pg_catalog.pg_stat_subscription_stats.subid</code>.
     */
    public final TableField<PgStatSubscriptionStatsRecord, Long> SUBID = createField(DSL.name("subid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_stat_subscription_stats.subname</code>.
     */
    public final TableField<PgStatSubscriptionStatsRecord, String> SUBNAME = createField(DSL.name("subname"), SQLDataType.VARCHAR, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_subscription_stats.apply_error_count</code>.
     */
    public final TableField<PgStatSubscriptionStatsRecord, Long> APPLY_ERROR_COUNT = createField(DSL.name("apply_error_count"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>pg_catalog.pg_stat_subscription_stats.sync_error_count</code>.
     */
    public final TableField<PgStatSubscriptionStatsRecord, Long> SYNC_ERROR_COUNT = createField(DSL.name("sync_error_count"), SQLDataType.BIGINT, this, "");

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

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

    private PgStatSubscriptionStats(Name alias, Table<PgStatSubscriptionStatsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "pg_stat_subscription_stats" as  SELECT ss.subid,
         s.subname,
         ss.apply_error_count,
         ss.sync_error_count,
         ss.stats_reset
        FROM pg_subscription s,
         LATERAL pg_stat_get_subscription_stats(s.oid) ss(subid, apply_error_count, sync_error_count, stats_reset);
        """), where);
    }

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

    /**
     * Create an aliased <code>pg_catalog.pg_stat_subscription_stats</code>
     * table reference
     */
    public PgStatSubscriptionStats(Name alias) {
        this(alias, PG_STAT_SUBSCRIPTION_STATS);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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