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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>journal_log.view_load_files_jour</code>
     */
    public static final ViewLoadFilesJour VIEW_LOAD_FILES_JOUR = new ViewLoadFilesJour();

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

    /**
     * The column
     * <code>journal_log.view_load_files_jour.load_files_jour_id</code>.
     */
    public final TableField<ViewLoadFilesJourRecord, Long> LOAD_FILES_JOUR_ID = createField(DSL.name("load_files_jour_id"), SQLDataType.BIGINT, this, "");

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

    /**
     * The column
     * <code>journal_log.view_load_files_jour.percent_load_without_error</code>.
     */
    public final TableField<ViewLoadFilesJourRecord, BigDecimal> PERCENT_LOAD_WITHOUT_ERROR = createField(DSL.name("percent_load_without_error"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_load_files_jour.percent_not_load_by_error</code>.
     */
    public final TableField<ViewLoadFilesJourRecord, BigDecimal> PERCENT_NOT_LOAD_BY_ERROR = createField(DSL.name("percent_not_load_by_error"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>journal_log.view_load_files_jour.percent_load_with_error</code>.
     */
    public final TableField<ViewLoadFilesJourRecord, BigDecimal> PERCENT_LOAD_WITH_ERROR = createField(DSL.name("percent_load_with_error"), SQLDataType.NUMERIC, this, "");

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

    private ViewLoadFilesJour(Name alias, Table<ViewLoadFilesJourRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_load_files_jour" as  SELECT load_files_jour.load_files_jour_id,
         ((load_files_jour.count_load_without_error + load_files_jour.count_not_load_by_error) + load_files_jour.count_load_with_error) AS count_all,
         round((((load_files_jour.count_load_without_error)::numeric * (100)::numeric) / (((load_files_jour.count_load_without_error + load_files_jour.count_not_load_by_error) + load_files_jour.count_load_with_error))::numeric)) AS percent_load_without_error,
         round((((load_files_jour.count_not_load_by_error)::numeric * (100)::numeric) / (((load_files_jour.count_load_without_error + load_files_jour.count_not_load_by_error) + load_files_jour.count_load_with_error))::numeric)) AS percent_not_load_by_error,
         round((((load_files_jour.count_load_with_error)::numeric * (100)::numeric) / (((load_files_jour.count_load_without_error + load_files_jour.count_not_load_by_error) + load_files_jour.count_load_with_error))::numeric)) AS percent_load_with_error
        FROM journal_log.load_files_jour;
        """), where);
    }

    /**
     * Create an aliased <code>journal_log.view_load_files_jour</code> table
     * reference
     */
    public ViewLoadFilesJour(String alias) {
        this(DSL.name(alias), VIEW_LOAD_FILES_JOUR);
    }

    /**
     * Create an aliased <code>journal_log.view_load_files_jour</code> table
     * reference
     */
    public ViewLoadFilesJour(Name alias) {
        this(alias, VIEW_LOAD_FILES_JOUR);
    }

    /**
     * Create a <code>journal_log.view_load_files_jour</code> table reference
     */
    public ViewLoadFilesJour() {
        this(DSL.name("view_load_files_jour"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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