/*
 * This file is generated by jOOQ.
 */
package ervu_secret.ervu_secret.db_beans.information_schema.tables;


import ervu_secret.ervu_secret.db_beans.information_schema.Domains;
import ervu_secret.ervu_secret.db_beans.information_schema.InformationSchema;
import ervu_secret.ervu_secret.db_beans.information_schema.tables.records.CheckConstraintRoutineUsageRecord;

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.TableImpl;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>information_schema.check_constraint_routine_usage</code>
     */
    public static final CheckConstraintRoutineUsage CHECK_CONSTRAINT_ROUTINE_USAGE = new CheckConstraintRoutineUsage();

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

    /**
     * The column
     * <code>information_schema.check_constraint_routine_usage.constraint_catalog</code>.
     */
    public final TableField<CheckConstraintRoutineUsageRecord, String> CONSTRAINT_CATALOG = createField(DSL.name("constraint_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.check_constraint_routine_usage.constraint_schema</code>.
     */
    public final TableField<CheckConstraintRoutineUsageRecord, String> CONSTRAINT_SCHEMA = createField(DSL.name("constraint_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.check_constraint_routine_usage.constraint_name</code>.
     */
    public final TableField<CheckConstraintRoutineUsageRecord, String> CONSTRAINT_NAME = createField(DSL.name("constraint_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.check_constraint_routine_usage.specific_catalog</code>.
     */
    public final TableField<CheckConstraintRoutineUsageRecord, String> SPECIFIC_CATALOG = createField(DSL.name("specific_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.check_constraint_routine_usage.specific_schema</code>.
     */
    public final TableField<CheckConstraintRoutineUsageRecord, String> SPECIFIC_SCHEMA = createField(DSL.name("specific_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.check_constraint_routine_usage.specific_name</code>.
     */
    public final TableField<CheckConstraintRoutineUsageRecord, String> SPECIFIC_NAME = createField(DSL.name("specific_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

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

    private CheckConstraintRoutineUsage(Name alias, Table<CheckConstraintRoutineUsageRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "check_constraint_routine_usage" as  SELECT DISTINCT (current_database())::information_schema.sql_identifier AS constraint_catalog,
          (nc.nspname)::information_schema.sql_identifier AS constraint_schema,
          (c.conname)::information_schema.sql_identifier AS constraint_name,
          (current_database())::information_schema.sql_identifier AS specific_catalog,
          (np.nspname)::information_schema.sql_identifier AS specific_schema,
          (nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS specific_name
         FROM pg_namespace nc,
          pg_constraint c,
          pg_depend d,
          pg_proc p,
          pg_namespace np
        WHERE ((nc.oid = c.connamespace) AND (c.contype = 'c'::"char") AND (c.oid = d.objid) AND (d.classid = ('pg_constraint'::regclass)::oid) AND (d.refobjid = p.oid) AND (d.refclassid = ('pg_proc'::regclass)::oid) AND (p.pronamespace = np.oid) AND pg_has_role(p.proowner, 'USAGE'::text));
        """), where);
    }

    /**
     * Create an aliased
     * <code>information_schema.check_constraint_routine_usage</code> table
     * reference
     */
    public CheckConstraintRoutineUsage(String alias) {
        this(DSL.name(alias), CHECK_CONSTRAINT_ROUTINE_USAGE);
    }

    /**
     * Create an aliased
     * <code>information_schema.check_constraint_routine_usage</code> table
     * reference
     */
    public CheckConstraintRoutineUsage(Name alias) {
        this(alias, CHECK_CONSTRAINT_ROUTINE_USAGE);
    }

    /**
     * Create a <code>information_schema.check_constraint_routine_usage</code>
     * table reference
     */
    public CheckConstraintRoutineUsage() {
        this(DSL.name("check_constraint_routine_usage"), null);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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