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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>admin_indicators.view_user_analysis</code>
     */
    public static final ViewUserAnalysis VIEW_USER_ANALYSIS = new ViewUserAnalysis();

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

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.user_analysis_id</code>.
     */
    public final TableField<ViewUserAnalysisRecord, Long> USER_ANALYSIS_ID = createField(DSL.name("user_analysis_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_administrator_is</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_ADMINISTRATOR_IS = createField(DSL.name("percent_administrator_is"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_administrator_poib</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_ADMINISTRATOR_POIB = createField(DSL.name("percent_administrator_poib"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_employee_gomy</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_EMPLOYEE_GOMY = createField(DSL.name("percent_employee_gomy"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_bserver_gomy</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_BSERVER_GOMY = createField(DSL.name("percent_bserver_gomy"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_supervisor_gomy</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_SUPERVISOR_GOMY = createField(DSL.name("percent_supervisor_gomy"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_military_commissar</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_MILITARY_COMMISSAR = createField(DSL.name("percent_military_commissar"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_specialist_statements</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_SPECIALIST_STATEMENTS = createField(DSL.name("percent_specialist_statements"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_observer_vo</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_OBSERVER_VO = createField(DSL.name("percent_observer_vo"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_observer_vk</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_OBSERVER_VK = createField(DSL.name("percent_observer_vk"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_administrator_military_office</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_ADMINISTRATOR_MILITARY_OFFICE = createField(DSL.name("percent_administrator_military_office"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_specialist_military_accounting</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_SPECIALIST_MILITARY_ACCOUNTING = createField(DSL.name("percent_specialist_military_accounting"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>admin_indicators.view_user_analysis.percent_specialist_acquisition</code>.
     */
    public final TableField<ViewUserAnalysisRecord, BigDecimal> PERCENT_SPECIALIST_ACQUISITION = createField(DSL.name("percent_specialist_acquisition"), SQLDataType.NUMERIC, this, "");

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

    private ViewUserAnalysis(Name alias, Table<ViewUserAnalysisRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_user_analysis" as  SELECT user_analysis.user_analysis_id,
         (((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition) AS count_all,
         COALESCE(round((((user_analysis.count_administrator_is)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_administrator_is,
         COALESCE(round((((user_analysis.count_administrator_poib)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_administrator_poib,
         COALESCE(round((((user_analysis.count_employee_gomy)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_employee_gomy,
         COALESCE(round((((user_analysis.count_observer_gomy)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_bserver_gomy,
         COALESCE(round((((user_analysis.count_supervisor_gomy)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_supervisor_gomy,
         COALESCE(round((((user_analysis.count_military_commissar)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_military_commissar,
         COALESCE(round((((user_analysis.count_specialist_statements)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_specialist_statements,
         COALESCE(round((((user_analysis.count_observer_vo)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_observer_vo,
         COALESCE(round((((user_analysis.count_observer_vk)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_observer_vk,
         COALESCE(round((((user_analysis.count_administrator_military_office)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_administrator_military_office,
         COALESCE(round((((user_analysis.count_specialist_military_accounting)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_specialist_military_accounting,
         COALESCE(round((((user_analysis.count_specialist_acquisition)::numeric * (100)::numeric) / NULLIF(((((((((((((user_analysis.count_administrator_is + user_analysis.count_administrator_poib) + user_analysis.count_employee_gomy) + user_analysis.count_observer_gomy) + user_analysis.count_supervisor_gomy) + user_analysis.count_military_commissar) + user_analysis.count_specialist_statements) + user_analysis.count_observer_vo) + user_analysis.count_observer_vk) + user_analysis.count_administrator_military_office) + user_analysis.count_specialist_military_accounting) + user_analysis.count_specialist_acquisition))::numeric, (0)::numeric))), (0)::numeric) AS percent_specialist_acquisition
        FROM admin_indicators.user_analysis;
        """), where);
    }

    /**
     * Create an aliased <code>admin_indicators.view_user_analysis</code> table
     * reference
     */
    public ViewUserAnalysis(String alias) {
        this(DSL.name(alias), VIEW_USER_ANALYSIS);
    }

    /**
     * Create an aliased <code>admin_indicators.view_user_analysis</code> table
     * reference
     */
    public ViewUserAnalysis(Name alias) {
        this(alias, VIEW_USER_ANALYSIS);
    }

    /**
     * Create a <code>admin_indicators.view_user_analysis</code> table reference
     */
    public ViewUserAnalysis() {
        this(DSL.name("view_user_analysis"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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