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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>init_registration_info.view_statuses_decisions_on_epgu</code>
     */
    public static final ViewStatusesDecisionsOnEpgu VIEW_STATUSES_DECISIONS_ON_EPGU = new ViewStatusesDecisionsOnEpgu();

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

    /**
     * The column
     * <code>init_registration_info.view_statuses_decisions_on_epgu.statuses_decisions_on_epgu_id</code>.
     */
    public final TableField<ViewStatusesDecisionsOnEpguRecord, Long> STATUSES_DECISIONS_ON_EPGU_ID = createField(DSL.name("statuses_decisions_on_epgu_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>init_registration_info.view_statuses_decisions_on_epgu.percent_formed_for_signing</code>.
     */
    public final TableField<ViewStatusesDecisionsOnEpguRecord, BigDecimal> PERCENT_FORMED_FOR_SIGNING = createField(DSL.name("percent_formed_for_signing"), SQLDataType.NUMERIC, this, "");

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

    private ViewStatusesDecisionsOnEpgu(Name alias, Table<ViewStatusesDecisionsOnEpguRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_statuses_decisions_on_epgu" as  SELECT statuses_decisions_on_epgu.statuses_decisions_on_epgu_id,
         COALESCE(round((((statuses_decisions_on_epgu.count_signed)::numeric * (100)::numeric) / NULLIF((statuses_decisions_on_epgu.count_loaded)::numeric, (0)::numeric))), (0)::numeric) AS percent_signed,
         COALESCE(round((((statuses_decisions_on_epgu.count_formed_for_signing)::numeric * (100)::numeric) / NULLIF((statuses_decisions_on_epgu.count_loaded)::numeric, (0)::numeric))), (0)::numeric) AS percent_formed_for_signing
        FROM init_registration_info.statuses_decisions_on_epgu;
        """), where);
    }

    /**
     * Create an aliased
     * <code>init_registration_info.view_statuses_decisions_on_epgu</code> table
     * reference
     */
    public ViewStatusesDecisionsOnEpgu(String alias) {
        this(DSL.name(alias), VIEW_STATUSES_DECISIONS_ON_EPGU);
    }

    /**
     * Create an aliased
     * <code>init_registration_info.view_statuses_decisions_on_epgu</code> table
     * reference
     */
    public ViewStatusesDecisionsOnEpgu(Name alias) {
        this(alias, VIEW_STATUSES_DECISIONS_ON_EPGU);
    }

    /**
     * Create a
     * <code>init_registration_info.view_statuses_decisions_on_epgu</code> table
     * reference
     */
    public ViewStatusesDecisionsOnEpgu() {
        this(DSL.name("view_statuses_decisions_on_epgu"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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