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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>metrics.view_convert_info_records_from_easu</code>
     */
    public static final ViewConvertInfoRecordsFromEasu VIEW_CONVERT_INFO_RECORDS_FROM_EASU = new ViewConvertInfoRecordsFromEasu();

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

    /**
     * The column
     * <code>metrics.view_convert_info_records_from_easu.convert_info_records_from_easu_id</code>.
     */
    public final TableField<ViewConvertInfoRecordsFromEasuRecord, Long> CONVERT_INFO_RECORDS_FROM_EASU_ID = createField(DSL.name("convert_info_records_from_easu_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>metrics.view_convert_info_records_from_easu.percent_completed_record</code>.
     */
    public final TableField<ViewConvertInfoRecordsFromEasuRecord, BigDecimal> PERCENT_COMPLETED_RECORD = createField(DSL.name("percent_completed_record"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>metrics.view_convert_info_records_from_easu.percent_flk_and_duplicate</code>.
     */
    public final TableField<ViewConvertInfoRecordsFromEasuRecord, BigDecimal> PERCENT_FLK_AND_DUPLICATE = createField(DSL.name("percent_flk_and_duplicate"), SQLDataType.NUMERIC, this, "");

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

    private ViewConvertInfoRecordsFromEasu(Name alias, Table<ViewConvertInfoRecordsFromEasuRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_convert_info_records_from_easu" as  SELECT convert_info_records_from_easu.convert_info_records_from_easu_id,
         (convert_info_records_from_easu.count_completed_record + convert_info_records_from_easu.count_flk_and_duplicate) AS count_all,
         COALESCE(round((((convert_info_records_from_easu.count_completed_record)::numeric * (100)::numeric) / NULLIF(((convert_info_records_from_easu.count_completed_record + convert_info_records_from_easu.count_flk_and_duplicate))::numeric, (0)::numeric))), (0)::numeric) AS percent_completed_record,
         COALESCE(round((((convert_info_records_from_easu.count_flk_and_duplicate)::numeric * (100)::numeric) / NULLIF(((convert_info_records_from_easu.count_completed_record + convert_info_records_from_easu.count_flk_and_duplicate))::numeric, (0)::numeric))), (0)::numeric) AS percent_flk_and_duplicate
        FROM metrics.convert_info_records_from_easu;
        """), where);
    }

    /**
     * Create an aliased
     * <code>metrics.view_convert_info_records_from_easu</code> table reference
     */
    public ViewConvertInfoRecordsFromEasu(String alias) {
        this(DSL.name(alias), VIEW_CONVERT_INFO_RECORDS_FROM_EASU);
    }

    /**
     * Create an aliased
     * <code>metrics.view_convert_info_records_from_easu</code> table reference
     */
    public ViewConvertInfoRecordsFromEasu(Name alias) {
        this(alias, VIEW_CONVERT_INFO_RECORDS_FROM_EASU);
    }

    /**
     * Create a <code>metrics.view_convert_info_records_from_easu</code> table
     * reference
     */
    public ViewConvertInfoRecordsFromEasu() {
        this(DSL.name("view_convert_info_records_from_easu"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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