/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.tables;


import java.math.BigDecimal;
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;

import ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.JournalLog;
import ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.tables.records.ViewEpguNoticeSentErrorRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>journal_log.view_epgu_notice_sent_error</code>
     */
    public static final ViewEpguNoticeSentError VIEW_EPGU_NOTICE_SENT_ERROR = new ViewEpguNoticeSentError();

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

    /**
     * The column
     * <code>journal_log.view_epgu_notice_sent_error.epgu_notice_sent_error_id</code>.
     */
    public final TableField<ViewEpguNoticeSentErrorRecord, Long> EPGU_NOTICE_SENT_ERROR_ID = createField(DSL.name("epgu_notice_sent_error_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>journal_log.view_epgu_notice_sent_error.count_all</code>.
     */
    public final TableField<ViewEpguNoticeSentErrorRecord, Long> COUNT_ALL = createField(DSL.name("count_all"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>journal_log.view_epgu_notice_sent_error.percent_sending_timeout</code>.
     */
    public final TableField<ViewEpguNoticeSentErrorRecord, BigDecimal> PERCENT_SENDING_TIMEOUT = createField(DSL.name("percent_sending_timeout"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_epgu_notice_sent_error.percent_delivery_timeout</code>.
     */
    public final TableField<ViewEpguNoticeSentErrorRecord, BigDecimal> PERCENT_DELIVERY_TIMEOUT = createField(DSL.name("percent_delivery_timeout"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_epgu_notice_sent_error.percent_error</code>.
     */
    public final TableField<ViewEpguNoticeSentErrorRecord, BigDecimal> PERCENT_ERROR = createField(DSL.name("percent_error"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_epgu_notice_sent_error.percent_not_formed</code>.
     */
    public final TableField<ViewEpguNoticeSentErrorRecord, BigDecimal> PERCENT_NOT_FORMED = createField(DSL.name("percent_not_formed"), SQLDataType.NUMERIC, this, "");

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

    private ViewEpguNoticeSentError(Name alias, Table<ViewEpguNoticeSentErrorRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_epgu_notice_sent_error" as  SELECT epgu_notice_sent_error.epgu_notice_sent_error_id,
         (((epgu_notice_sent_error.count_sending_timeout + epgu_notice_sent_error.count_delivery_timeout) + epgu_notice_sent_error.count_error) + epgu_notice_sent_error.count_not_formed) AS count_all,
         round((((epgu_notice_sent_error.count_sending_timeout)::numeric * (100)::numeric) / ((((epgu_notice_sent_error.count_sending_timeout + epgu_notice_sent_error.count_delivery_timeout) + epgu_notice_sent_error.count_error) + epgu_notice_sent_error.count_not_formed))::numeric)) AS percent_sending_timeout,
         round((((epgu_notice_sent_error.count_delivery_timeout)::numeric * (100)::numeric) / ((((epgu_notice_sent_error.count_sending_timeout + epgu_notice_sent_error.count_delivery_timeout) + epgu_notice_sent_error.count_error) + epgu_notice_sent_error.count_not_formed))::numeric)) AS percent_delivery_timeout,
         round((((epgu_notice_sent_error.count_error)::numeric * (100)::numeric) / ((((epgu_notice_sent_error.count_sending_timeout + epgu_notice_sent_error.count_delivery_timeout) + epgu_notice_sent_error.count_error) + epgu_notice_sent_error.count_not_formed))::numeric)) AS percent_error,
         round((((epgu_notice_sent_error.count_not_formed)::numeric * (100)::numeric) / ((((epgu_notice_sent_error.count_sending_timeout + epgu_notice_sent_error.count_delivery_timeout) + epgu_notice_sent_error.count_error) + epgu_notice_sent_error.count_not_formed))::numeric)) AS percent_not_formed
        FROM journal_log.epgu_notice_sent_error;
        """), where);
    }

    /**
     * Create an aliased <code>journal_log.view_epgu_notice_sent_error</code>
     * table reference
     */
    public ViewEpguNoticeSentError(String alias) {
        this(DSL.name(alias), VIEW_EPGU_NOTICE_SENT_ERROR);
    }

    /**
     * Create an aliased <code>journal_log.view_epgu_notice_sent_error</code>
     * table reference
     */
    public ViewEpguNoticeSentError(Name alias) {
        this(alias, VIEW_EPGU_NOTICE_SENT_ERROR);
    }

    /**
     * Create a <code>journal_log.view_epgu_notice_sent_error</code> table
     * reference
     */
    public ViewEpguNoticeSentError() {
        this(DSL.name("view_epgu_notice_sent_error"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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