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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>init_registration_info.view_records_info_id_uk_id_ern</code>
     */
    public static final ViewRecordsInfoIdUkIdErn VIEW_RECORDS_INFO_ID_UK_ID_ERN = new ViewRecordsInfoIdUkIdErn();

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

    /**
     * The column
     * <code>init_registration_info.view_records_info_id_uk_id_ern.records_info_id_uk_id_ern_id</code>.
     */
    public final TableField<ViewRecordsInfoIdUkIdErnRecord, Long> RECORDS_INFO_ID_UK_ID_ERN_ID = createField(DSL.name("records_info_id_uk_id_ern_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>init_registration_info.view_records_info_id_uk_id_ern.percent_with_id_uk</code>.
     */
    public final TableField<ViewRecordsInfoIdUkIdErnRecord, BigDecimal> PERCENT_WITH_ID_UK = createField(DSL.name("percent_with_id_uk"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>init_registration_info.view_records_info_id_uk_id_ern.percent_without_id_uk</code>.
     */
    public final TableField<ViewRecordsInfoIdUkIdErnRecord, BigDecimal> PERCENT_WITHOUT_ID_UK = createField(DSL.name("percent_without_id_uk"), SQLDataType.NUMERIC, this, "");

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

    private ViewRecordsInfoIdUkIdErn(Name alias, Table<ViewRecordsInfoIdUkIdErnRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_records_info_id_uk_id_ern" as  SELECT records_info_id_uk_id_ern.records_info_id_uk_id_ern_id,
         (records_info_id_uk_id_ern.records_with_id_uk + records_info_id_uk_id_ern.records_without_id_uk) AS count_all,
         COALESCE(round((((records_info_id_uk_id_ern.records_with_id_uk)::numeric * (100)::numeric) / NULLIF(((records_info_id_uk_id_ern.records_with_id_uk + records_info_id_uk_id_ern.records_without_id_uk))::numeric, (0)::numeric))), (0)::numeric) AS percent_with_id_uk,
         COALESCE(round((((records_info_id_uk_id_ern.records_without_id_uk)::numeric * (100)::numeric) / NULLIF(((records_info_id_uk_id_ern.records_with_id_uk + records_info_id_uk_id_ern.records_without_id_uk))::numeric, (0)::numeric))), (0)::numeric) AS percent_without_id_uk
        FROM init_registration_info.records_info_id_uk_id_ern;
        """), where);
    }

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

    /**
     * Create an aliased
     * <code>init_registration_info.view_records_info_id_uk_id_ern</code> table
     * reference
     */
    public ViewRecordsInfoIdUkIdErn(Name alias) {
        this(alias, VIEW_RECORDS_INFO_ID_UK_ID_ERN);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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