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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>actualization.view_change_data_from_gir_vu</code>
     */
    public static final ViewChangeDataFromGirVu VIEW_CHANGE_DATA_FROM_GIR_VU = new ViewChangeDataFromGirVu();

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

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.change_data_from_gir_vu_id</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, Long> CHANGE_DATA_FROM_GIR_VU_ID = createField(DSL.name("change_data_from_gir_vu_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_reg_address</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_REG_ADDRESS = createField(DSL.name("percent_reg_address"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_place_of_stay</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_PLACE_OF_STAY = createField(DSL.name("percent_place_of_stay"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_work</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_WORK = createField(DSL.name("percent_work"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_place_of_study</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_PLACE_OF_STUDY = createField(DSL.name("percent_place_of_study"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_family_status</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_FAMILY_STATUS = createField(DSL.name("percent_family_status"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_education</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_EDUCATION = createField(DSL.name("percent_education"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_renaming</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_RENAMING = createField(DSL.name("percent_renaming"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_med_info</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_MED_INFO = createField(DSL.name("percent_med_info"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>actualization.view_change_data_from_gir_vu.percent_other</code>.
     */
    public final TableField<ViewChangeDataFromGirVuRecord, BigDecimal> PERCENT_OTHER = createField(DSL.name("percent_other"), SQLDataType.NUMERIC, this, "");

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

    private ViewChangeDataFromGirVu(Name alias, Table<ViewChangeDataFromGirVuRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_change_data_from_gir_vu" as  SELECT change_data_from_gir_vu.change_data_from_gir_vu_id,
         ((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other) AS count_all,
         COALESCE(round((((change_data_from_gir_vu.count_reg_address)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_reg_address,
         COALESCE(round((((change_data_from_gir_vu.count_place_of_stay)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_place_of_stay,
         COALESCE(round((((change_data_from_gir_vu.count_work)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_work,
         COALESCE(round((((change_data_from_gir_vu.count_place_of_study)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_place_of_study,
         COALESCE(round((((change_data_from_gir_vu.count_family_status)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_family_status,
         COALESCE(round((((change_data_from_gir_vu.count_education)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_education,
         COALESCE(round((((change_data_from_gir_vu.count_renaming)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_renaming,
         COALESCE(round((((change_data_from_gir_vu.count_med_info)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_med_info,
         COALESCE(round((((change_data_from_gir_vu.count_other)::numeric * (100)::numeric) / NULLIF((((((((((change_data_from_gir_vu.count_reg_address + change_data_from_gir_vu.count_place_of_stay) + change_data_from_gir_vu.count_work) + change_data_from_gir_vu.count_place_of_study) + change_data_from_gir_vu.count_family_status) + change_data_from_gir_vu.count_education) + change_data_from_gir_vu.count_renaming) + change_data_from_gir_vu.count_med_info) + change_data_from_gir_vu.count_other))::numeric, (0)::numeric))), (0)::numeric) AS percent_other
        FROM actualization.change_data_from_gir_vu;
        """), where);
    }

    /**
     * Create an aliased <code>actualization.view_change_data_from_gir_vu</code>
     * table reference
     */
    public ViewChangeDataFromGirVu(String alias) {
        this(DSL.name(alias), VIEW_CHANGE_DATA_FROM_GIR_VU);
    }

    /**
     * Create an aliased <code>actualization.view_change_data_from_gir_vu</code>
     * table reference
     */
    public ViewChangeDataFromGirVu(Name alias) {
        this(alias, VIEW_CHANGE_DATA_FROM_GIR_VU);
    }

    /**
     * Create a <code>actualization.view_change_data_from_gir_vu</code> table
     * reference
     */
    public ViewChangeDataFromGirVu() {
        this(DSL.name("view_change_data_from_gir_vu"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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