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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>registration_change_address.view_incidents_epgu_info</code>
     */
    public static final ViewIncidentsEpguInfo VIEW_INCIDENTS_EPGU_INFO = new ViewIncidentsEpguInfo();

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

    /**
     * The column
     * <code>registration_change_address.view_incidents_epgu_info.incidents_epgu_info_id</code>.
     */
    public final TableField<ViewIncidentsEpguInfoRecord, Long> INCIDENTS_EPGU_INFO_ID = createField(DSL.name("incidents_epgu_info_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>registration_change_address.view_incidents_epgu_info.percent_registered</code>.
     */
    public final TableField<ViewIncidentsEpguInfoRecord, BigDecimal> PERCENT_REGISTERED = createField(DSL.name("percent_registered"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>registration_change_address.view_incidents_epgu_info.count_not_identify</code>.
     */
    public final TableField<ViewIncidentsEpguInfoRecord, Long> COUNT_NOT_IDENTIFY = createField(DSL.name("count_not_identify"), SQLDataType.BIGINT, this, "");

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

    private ViewIncidentsEpguInfo(Name alias, Table<ViewIncidentsEpguInfoRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_incidents_epgu_info" as  SELECT incidents_epgu_info.incidents_epgu_info_id,
         COALESCE(round((((incidents_epgu_info.count_registered)::numeric * (100)::numeric) / NULLIF((incidents_epgu_info.count_identify)::numeric, (0)::numeric))), (0)::numeric) AS percent_registered,
         (incidents_epgu_info.count_identify - incidents_epgu_info.count_registered) AS count_not_identify
        FROM registration_change_address.incidents_epgu_info;
        """), where);
    }

    /**
     * Create an aliased
     * <code>registration_change_address.view_incidents_epgu_info</code> table
     * reference
     */
    public ViewIncidentsEpguInfo(String alias) {
        this(DSL.name(alias), VIEW_INCIDENTS_EPGU_INFO);
    }

    /**
     * Create an aliased
     * <code>registration_change_address.view_incidents_epgu_info</code> table
     * reference
     */
    public ViewIncidentsEpguInfo(Name alias) {
        this(alias, VIEW_INCIDENTS_EPGU_INFO);
    }

    /**
     * Create a
     * <code>registration_change_address.view_incidents_epgu_info</code> table
     * reference
     */
    public ViewIncidentsEpguInfo() {
        this(DSL.name("view_incidents_epgu_info"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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