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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>summonses_list.view_remove_tmp_measures</code>
     */
    public static final ViewRemoveTmpMeasures VIEW_REMOVE_TMP_MEASURES = new ViewRemoveTmpMeasures();

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

    /**
     * The column
     * <code>summonses_list.view_remove_tmp_measures.remove_tmp_measures_id</code>.
     */
    public final TableField<ViewRemoveTmpMeasuresRecord, Long> REMOVE_TMP_MEASURES_ID = createField(DSL.name("remove_tmp_measures_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>summonses_list.view_remove_tmp_measures.percent_formed</code>.
     */
    public final TableField<ViewRemoveTmpMeasuresRecord, BigDecimal> PERCENT_FORMED = createField(DSL.name("percent_formed"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_remove_tmp_measures.percent_for_sign</code>.
     */
    public final TableField<ViewRemoveTmpMeasuresRecord, BigDecimal> PERCENT_FOR_SIGN = createField(DSL.name("percent_for_sign"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_remove_tmp_measures.percent_signed</code>.
     */
    public final TableField<ViewRemoveTmpMeasuresRecord, BigDecimal> PERCENT_SIGNED = createField(DSL.name("percent_signed"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>summonses_list.view_remove_tmp_measures.percent_removed</code>.
     */
    public final TableField<ViewRemoveTmpMeasuresRecord, BigDecimal> PERCENT_REMOVED = createField(DSL.name("percent_removed"), SQLDataType.NUMERIC, this, "");

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

    private ViewRemoveTmpMeasures(Name alias, Table<ViewRemoveTmpMeasuresRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_remove_tmp_measures" as  SELECT remove_tmp_measures.remove_tmp_measures_id,
         (((remove_tmp_measures.count_formed + remove_tmp_measures.count_for_sign) + remove_tmp_measures.count_signed) + remove_tmp_measures.count_removed) AS count_all,
         COALESCE(round((((remove_tmp_measures.count_formed)::numeric * (100)::numeric) / NULLIF(((((remove_tmp_measures.count_formed + remove_tmp_measures.count_for_sign) + remove_tmp_measures.count_signed) + remove_tmp_measures.count_removed))::numeric, (0)::numeric))), (0)::numeric) AS percent_formed,
         COALESCE(round((((remove_tmp_measures.count_for_sign)::numeric * (100)::numeric) / NULLIF(((((remove_tmp_measures.count_formed + remove_tmp_measures.count_for_sign) + remove_tmp_measures.count_signed) + remove_tmp_measures.count_removed))::numeric, (0)::numeric))), (0)::numeric) AS percent_for_sign,
         COALESCE(round((((remove_tmp_measures.count_signed)::numeric * (100)::numeric) / NULLIF(((((remove_tmp_measures.count_formed + remove_tmp_measures.count_for_sign) + remove_tmp_measures.count_signed) + remove_tmp_measures.count_removed))::numeric, (0)::numeric))), (0)::numeric) AS percent_signed,
         COALESCE(round((((remove_tmp_measures.count_removed)::numeric * (100)::numeric) / NULLIF(((((remove_tmp_measures.count_formed + remove_tmp_measures.count_for_sign) + remove_tmp_measures.count_signed) + remove_tmp_measures.count_removed))::numeric, (0)::numeric))), (0)::numeric) AS percent_removed
        FROM summonses_list.remove_tmp_measures;
        """), where);
    }

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

    /**
     * Create an aliased <code>summonses_list.view_remove_tmp_measures</code>
     * table reference
     */
    public ViewRemoveTmpMeasures(Name alias) {
        this(alias, VIEW_REMOVE_TMP_MEASURES);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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