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

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 RoleUdtGrants extends TableImpl<RoleUdtGrantsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>information_schema.role_udt_grants</code>
     */
    public static final RoleUdtGrants ROLE_UDT_GRANTS = new RoleUdtGrants();

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

    /**
     * The column <code>information_schema.role_udt_grants.grantor</code>.
     */
    public final TableField<RoleUdtGrantsRecord, String> GRANTOR = createField(DSL.name("grantor"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.role_udt_grants.grantee</code>.
     */
    public final TableField<RoleUdtGrantsRecord, String> GRANTEE = createField(DSL.name("grantee"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.role_udt_grants.udt_catalog</code>.
     */
    public final TableField<RoleUdtGrantsRecord, String> UDT_CATALOG = createField(DSL.name("udt_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.role_udt_grants.udt_schema</code>.
     */
    public final TableField<RoleUdtGrantsRecord, String> UDT_SCHEMA = createField(DSL.name("udt_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.role_udt_grants.udt_name</code>.
     */
    public final TableField<RoleUdtGrantsRecord, String> UDT_NAME = createField(DSL.name("udt_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.role_udt_grants.privilege_type</code>.
     */
    public final TableField<RoleUdtGrantsRecord, String> PRIVILEGE_TYPE = createField(DSL.name("privilege_type"), Domains.CHARACTER_DATA.getDataType(), this, "");

    /**
     * The column <code>information_schema.role_udt_grants.is_grantable</code>.
     */
    public final TableField<RoleUdtGrantsRecord, String> IS_GRANTABLE = createField(DSL.name("is_grantable"), Domains.YES_OR_NO.getDataType(), this, "");

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

    private RoleUdtGrants(Name alias, Table<RoleUdtGrantsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "role_udt_grants" as  SELECT udt_privileges.grantor,
          udt_privileges.grantee,
          udt_privileges.udt_catalog,
          udt_privileges.udt_schema,
          udt_privileges.udt_name,
          udt_privileges.privilege_type,
          udt_privileges.is_grantable
         FROM information_schema.udt_privileges
        WHERE (((udt_privileges.grantor)::name IN ( SELECT enabled_roles.role_name
                 FROM information_schema.enabled_roles)) OR ((udt_privileges.grantee)::name IN ( SELECT enabled_roles.role_name
                 FROM information_schema.enabled_roles)));
        """), where);
    }

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

    /**
     * Create an aliased <code>information_schema.role_udt_grants</code> table
     * reference
     */
    public RoleUdtGrants(Name alias) {
        this(alias, ROLE_UDT_GRANTS);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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