/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.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.summonses_list.SummonsesList;
import ru.micord.webbpm.ervu.business_metrics.db_beans.summonses_list.tables.records.ViewInfoSentToLkEpguRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>summonses_list.view_info_sent_to_lk_epgu</code>
     */
    public static final ViewInfoSentToLkEpgu VIEW_INFO_SENT_TO_LK_EPGU = new ViewInfoSentToLkEpgu();

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

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.info_sent_to_lk_epgu_id</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, Long> INFO_SENT_TO_LK_EPGU_ID = createField(DSL.name("info_sent_to_lk_epgu_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_status_formed</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_STATUS_FORMED = createField(DSL.name("percent_status_formed"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_status_not_formed</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_STATUS_NOT_FORMED = createField(DSL.name("percent_status_not_formed"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_sended</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_SENDED = createField(DSL.name("percent_sended"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_delivered</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_DELIVERED = createField(DSL.name("percent_delivered"), SQLDataType.NUMERIC, this, "");

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

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_viewed</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_VIEWED = createField(DSL.name("percent_viewed"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_not_viewed</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_NOT_VIEWED = createField(DSL.name("percent_not_viewed"), SQLDataType.NUMERIC, this, "");

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

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_exceeded_send</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_EXCEEDED_SEND = createField(DSL.name("percent_exceeded_send"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_info_sent_to_lk_epgu.percent_exceeded_delivered</code>.
     */
    public final TableField<ViewInfoSentToLkEpguRecord, BigDecimal> PERCENT_EXCEEDED_DELIVERED = createField(DSL.name("percent_exceeded_delivered"), SQLDataType.NUMERIC, this, "");

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

    private ViewInfoSentToLkEpgu(Name alias, Table<ViewInfoSentToLkEpguRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_info_sent_to_lk_epgu" as  SELECT info_sent_to_lk_epgu.info_sent_to_lk_epgu_id,
         COALESCE(round((((info_sent_to_lk_epgu.count_status_formed)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_status_formed,
         COALESCE(round((((info_sent_to_lk_epgu.count_status_not_formed)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_status_not_formed,
         COALESCE(round((((info_sent_to_lk_epgu.count_sended)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_sended,
         COALESCE(round((((info_sent_to_lk_epgu.count_delivered)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_delivered,
         COALESCE(round((((info_sent_to_lk_epgu.count_error)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_error,
         COALESCE(round((((info_sent_to_lk_epgu.count_viewed)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_viewed,
         COALESCE(round((((info_sent_to_lk_epgu.count_not_viewed)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_not_viewed,
         (info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed) AS count_all,
         COALESCE(round((((info_sent_to_lk_epgu.count_exceeded_send)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_exceeded_send,
         COALESCE(round((((info_sent_to_lk_epgu.count_exceeded_delivered)::numeric * (100)::numeric) / NULLIF(((info_sent_to_lk_epgu.count_status_formed + info_sent_to_lk_epgu.count_status_not_formed))::numeric, (0)::numeric))), (0)::numeric) AS percent_exceeded_delivered
        FROM summonses_list.info_sent_to_lk_epgu;
        """), where);
    }

    /**
     * Create an aliased <code>summonses_list.view_info_sent_to_lk_epgu</code>
     * table reference
     */
    public ViewInfoSentToLkEpgu(String alias) {
        this(DSL.name(alias), VIEW_INFO_SENT_TO_LK_EPGU);
    }

    /**
     * Create an aliased <code>summonses_list.view_info_sent_to_lk_epgu</code>
     * table reference
     */
    public ViewInfoSentToLkEpgu(Name alias) {
        this(alias, VIEW_INFO_SENT_TO_LK_EPGU);
    }

    /**
     * Create a <code>summonses_list.view_info_sent_to_lk_epgu</code> table
     * reference
     */
    public ViewInfoSentToLkEpgu() {
        this(DSL.name("view_info_sent_to_lk_epgu"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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