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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>journal_log.view_summonses_list_data_exchange_error</code>
     */
    public static final ViewSummonsesListDataExchangeError VIEW_SUMMONSES_LIST_DATA_EXCHANGE_ERROR = new ViewSummonsesListDataExchangeError();

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

    /**
     * The column
     * <code>journal_log.view_summonses_list_data_exchange_error.summonses_list_data_exchange_error_id</code>.
     */
    public final TableField<ViewSummonsesListDataExchangeErrorRecord, Long> SUMMONSES_LIST_DATA_EXCHANGE_ERROR_ID = createField(DSL.name("summonses_list_data_exchange_error_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>journal_log.view_summonses_list_data_exchange_error.percent_error_1</code>.
     */
    public final TableField<ViewSummonsesListDataExchangeErrorRecord, BigDecimal> PERCENT_ERROR_1 = createField(DSL.name("percent_error_1"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_summonses_list_data_exchange_error.percent_error_2</code>.
     */
    public final TableField<ViewSummonsesListDataExchangeErrorRecord, BigDecimal> PERCENT_ERROR_2 = createField(DSL.name("percent_error_2"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_summonses_list_data_exchange_error.percent_error_3</code>.
     */
    public final TableField<ViewSummonsesListDataExchangeErrorRecord, BigDecimal> PERCENT_ERROR_3 = createField(DSL.name("percent_error_3"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_summonses_list_data_exchange_error.percent_error_4</code>.
     */
    public final TableField<ViewSummonsesListDataExchangeErrorRecord, BigDecimal> PERCENT_ERROR_4 = createField(DSL.name("percent_error_4"), SQLDataType.NUMERIC, this, "");

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

    private ViewSummonsesListDataExchangeError(Name alias, Table<ViewSummonsesListDataExchangeErrorRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_summonses_list_data_exchange_error" as  SELECT summonses_list_data_exchange_error.summonses_list_data_exchange_error_id,
         (((summonses_list_data_exchange_error.count_error_1 + summonses_list_data_exchange_error.count_error_2) + summonses_list_data_exchange_error.count_error_3) + summonses_list_data_exchange_error.count_error_4) AS count_all,
         round((((summonses_list_data_exchange_error.count_error_1)::numeric * (100)::numeric) / ((((summonses_list_data_exchange_error.count_error_1 + summonses_list_data_exchange_error.count_error_2) + summonses_list_data_exchange_error.count_error_3) + summonses_list_data_exchange_error.count_error_4))::numeric)) AS percent_error_1,
         round((((summonses_list_data_exchange_error.count_error_2)::numeric * (100)::numeric) / ((((summonses_list_data_exchange_error.count_error_1 + summonses_list_data_exchange_error.count_error_2) + summonses_list_data_exchange_error.count_error_3) + summonses_list_data_exchange_error.count_error_4))::numeric)) AS percent_error_2,
         round((((summonses_list_data_exchange_error.count_error_3)::numeric * (100)::numeric) / ((((summonses_list_data_exchange_error.count_error_1 + summonses_list_data_exchange_error.count_error_2) + summonses_list_data_exchange_error.count_error_3) + summonses_list_data_exchange_error.count_error_4))::numeric)) AS percent_error_3,
         round((((summonses_list_data_exchange_error.count_error_4)::numeric * (100)::numeric) / ((((summonses_list_data_exchange_error.count_error_1 + summonses_list_data_exchange_error.count_error_2) + summonses_list_data_exchange_error.count_error_3) + summonses_list_data_exchange_error.count_error_4))::numeric)) AS percent_error_4
        FROM journal_log.summonses_list_data_exchange_error;
        """), where);
    }

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

    /**
     * Create an aliased
     * <code>journal_log.view_summonses_list_data_exchange_error</code> table
     * reference
     */
    public ViewSummonsesListDataExchangeError(Name alias) {
        this(alias, VIEW_SUMMONSES_LIST_DATA_EXCHANGE_ERROR);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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