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

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 RoleTableGrants extends TableImpl<RoleTableGrantsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of
     * <code>information_schema.role_table_grants</code>
     */
    public static final RoleTableGrants ROLE_TABLE_GRANTS = new RoleTableGrants();

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

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

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

    /**
     * The column
     * <code>information_schema.role_table_grants.table_catalog</code>.
     */
    public final TableField<RoleTableGrantsRecord, String> TABLE_CATALOG = createField(DSL.name("table_catalog"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column
     * <code>information_schema.role_table_grants.table_schema</code>.
     */
    public final TableField<RoleTableGrantsRecord, String> TABLE_SCHEMA = createField(DSL.name("table_schema"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

    /**
     * The column <code>information_schema.role_table_grants.table_name</code>.
     */
    public final TableField<RoleTableGrantsRecord, String> TABLE_NAME = createField(DSL.name("table_name"), Domains.SQL_IDENTIFIER.getDataType(), this, "");

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

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

    /**
     * The column
     * <code>information_schema.role_table_grants.with_hierarchy</code>.
     */
    public final TableField<RoleTableGrantsRecord, String> WITH_HIERARCHY = createField(DSL.name("with_hierarchy"), Domains.YES_OR_NO.getDataType(), this, "");

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

    private RoleTableGrants(Name alias, Table<RoleTableGrantsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "role_table_grants" as  SELECT table_privileges.grantor,
          table_privileges.grantee,
          table_privileges.table_catalog,
          table_privileges.table_schema,
          table_privileges.table_name,
          table_privileges.privilege_type,
          table_privileges.is_grantable,
          table_privileges.with_hierarchy
         FROM information_schema.table_privileges
        WHERE (((table_privileges.grantor)::name IN ( SELECT enabled_roles.role_name
                 FROM information_schema.enabled_roles)) OR ((table_privileges.grantee)::name IN ( SELECT enabled_roles.role_name
                 FROM information_schema.enabled_roles)));
        """), where);
    }

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

    /**
     * Create an aliased <code>information_schema.role_table_grants</code> table
     * reference
     */
    public RoleTableGrants(Name alias) {
        this(alias, ROLE_TABLE_GRANTS);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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