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


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>deregistration.view_generated_solutions</code>
     */
    public static final ViewGeneratedSolutions VIEW_GENERATED_SOLUTIONS = new ViewGeneratedSolutions();

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

    /**
     * The column
     * <code>deregistration.view_generated_solutions.generated_solutions_id</code>.
     */
    public final TableField<ViewGeneratedSolutionsRecord, Long> GENERATED_SOLUTIONS_ID = createField(DSL.name("generated_solutions_id"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>deregistration.view_generated_solutions.count_arrived_all</code>.
     */
    public final TableField<ViewGeneratedSolutionsRecord, Long> COUNT_ARRIVED_ALL = createField(DSL.name("count_arrived_all"), SQLDataType.BIGINT, this, "");

    /**
     * The column
     * <code>deregistration.view_generated_solutions.percent_arrived_death_reason</code>.
     */
    public final TableField<ViewGeneratedSolutionsRecord, BigDecimal> PERCENT_ARRIVED_DEATH_REASON = createField(DSL.name("percent_arrived_death_reason"), SQLDataType.NUMERIC, this, "");

    /**
     * The column
     * <code>deregistration.view_generated_solutions.percent_arrived_age_limit</code>.
     */
    public final TableField<ViewGeneratedSolutionsRecord, BigDecimal> PERCENT_ARRIVED_AGE_LIMIT = createField(DSL.name("percent_arrived_age_limit"), SQLDataType.NUMERIC, this, "");

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

    private ViewGeneratedSolutions(Name alias, Table<ViewGeneratedSolutionsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "view_generated_solutions" as  SELECT generated_solutions.generated_solutions_id,
         (generated_solutions.count_arrived_death_reason + generated_solutions.count_arrived_age_limit) AS count_arrived_all,
         round((((generated_solutions.count_arrived_death_reason)::numeric * (100)::numeric) / ((generated_solutions.count_arrived_death_reason + generated_solutions.count_arrived_age_limit))::numeric)) AS percent_arrived_death_reason,
         round((((generated_solutions.count_arrived_age_limit)::numeric * (100)::numeric) / ((generated_solutions.count_arrived_death_reason + generated_solutions.count_arrived_age_limit))::numeric)) AS percent_arrived_age_limit
        FROM deregistration.generated_solutions;
        """), where);
    }

    /**
     * Create an aliased <code>deregistration.view_generated_solutions</code>
     * table reference
     */
    public ViewGeneratedSolutions(String alias) {
        this(DSL.name(alias), VIEW_GENERATED_SOLUTIONS);
    }

    /**
     * Create an aliased <code>deregistration.view_generated_solutions</code>
     * table reference
     */
    public ViewGeneratedSolutions(Name alias) {
        this(alias, VIEW_GENERATED_SOLUTIONS);
    }

    /**
     * Create a <code>deregistration.view_generated_solutions</code> table
     * reference
     */
    public ViewGeneratedSolutions() {
        this(DSL.name("view_generated_solutions"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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