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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>metrics.view_convert_info_comparison_csv_xml</code>
     */
    public static final ViewConvertInfoComparisonCsvXml VIEW_CONVERT_INFO_COMPARISON_CSV_XML = new ViewConvertInfoComparisonCsvXml();

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

    /**
     * The column
     * <code>metrics.view_convert_info_comparison_csv_xml.convert_info_comparison_csv_xml_id</code>.
     */
    public final TableField<ViewConvertInfoComparisonCsvXmlRecord, Long> CONVERT_INFO_COMPARISON_CSV_XML_ID = createField(DSL.name("convert_info_comparison_csv_xml_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>metrics.view_convert_info_comparison_csv_xml.percent_csv_formed</code>.
     */
    public final TableField<ViewConvertInfoComparisonCsvXmlRecord, BigDecimal> PERCENT_CSV_FORMED = createField(DSL.name("percent_csv_formed"), SQLDataType.NUMERIC, this, "");

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

    private ViewConvertInfoComparisonCsvXml(Name alias, Table<ViewConvertInfoComparisonCsvXmlRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_convert_info_comparison_csv_xml" as  SELECT convert_info_comparison_csv_xml.convert_info_comparison_csv_xml_id,
         COALESCE(round((((convert_info_comparison_csv_xml.count_csv_formed)::numeric * (100)::numeric) / NULLIF((convert_info_comparison_csv_xml.count_xml_formed)::numeric, (0)::numeric))), (0)::numeric) AS percent_csv_formed
        FROM metrics.convert_info_comparison_csv_xml;
        """), where);
    }

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

    /**
     * Create an aliased
     * <code>metrics.view_convert_info_comparison_csv_xml</code> table reference
     */
    public ViewConvertInfoComparisonCsvXml(Name alias) {
        this(alias, VIEW_CONVERT_INFO_COMPARISON_CSV_XML);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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