import { UserInfo, QueryCacheConfig } from "@memberjunction/core";
import { MJQueryEntity, MJQueryFieldEntity, MJQueryParameterEntity, MJQueryEntityEntity, MJQueryPermissionEntity, MJQueryDependencyEntity, MJQueryCategoryEntity } from "../generated/entity_subclasses.js";
import type { DatabasePlatform } from "@memberjunction/core";
/**
 * Extended query entity with child-relationship getters and business logic.
 * All child data reads through `QueryEngine`'s event-driven cache — always
 * fresh, no `provider.Refresh()` needed.
 *
 * Available on both client and server. Server-specific logic (embedding,
 * extraction pipeline, dialect conversion) lives in `MJQueryEntityServer`.
 */
export declare class MJQueryEntityExtended extends MJQueryEntity {
    /** All field definitions for this query */
    get QueryFields(): MJQueryFieldEntity[];
    /** All parameter definitions for this query */
    get QueryParameters(): MJQueryParameterEntity[];
    /** All entity associations for this query */
    get QueryEntities(): MJQueryEntityEntity[];
    /** All permission records for this query */
    get QueryPermissions(): MJQueryPermissionEntity[];
    /** All composition dependency records (queries this query references via {{query:"..."}} syntax) */
    get QueryDependencies(): MJQueryDependencyEntity[];
    /** Queries that depend on (reference) this query via {{query:"..."}} syntax */
    get QueryDependents(): MJQueryDependencyEntity[];
    /** Gets the category entity for this query, or undefined if uncategorized */
    get CategoryEntity(): MJQueryCategoryEntity | undefined;
    private _categoryPath;
    /**
     * Gets the full hierarchical path of this query's category (e.g., "Ground-Truth-Queries/Sales").
     * Returns empty string if the query is not categorized.
     */
    get CategoryPath(): string;
    /**
     * Builds a category path string from a CategoryID by walking up the category hierarchy.
     */
    BuildCategoryPath(categoryID: string): string;
    /**
     * Checks if a user has permission to run this query based on their roles.
     * A user can run a query if:
     * 1. The query has no permissions defined (open to all)
     * 2. The user has at least one role that is granted permission
     */
    UserHasRunPermissions(user: UserInfo): boolean;
    /**
     * Checks whether a user can run this query, considering query-level permissions,
     * entity-level read permissions, and composition dependencies (recursive).
     *
     * Permission logic:
     * 1. Check query-level run permissions (role-based)
     * 2. If the query has explicit Query Permissions, those take precedence for this
     *    query AND its composition dependencies (stored-procedure semantics)
     * 3. If no explicit Query Permissions, check entity read permissions for all
     *    referenced entities via the Query Entities bridge
     * 4. Recursively check all composition dependencies ({{query:"..."}})
     *
     * @param user The user to check permissions for
     * @param _visited Internal — tracks visited query IDs to prevent infinite loops in cyclic dependencies
     * @returns Object with canRun boolean and list of denied entity names
     */
    UserCanRun(user: UserInfo, _visited?: Set<string>): {
        canRun: boolean;
        deniedEntities: string[];
    };
    /** Whether this query has been formally approved for production use */
    get IsApproved(): boolean;
    /**
     * Whether this query can be referenced by other queries via composition syntax.
     * A query is composable only when both Reusable=true and Status='Approved'.
     */
    get IsComposable(): boolean;
    /**
     * Resolves the SQL for a given database platform.
     * Resolution order:
     *   1. QuerySQL child table entry matching this query + platform's dialect
     *   2. Base SQL property (the query's primary SQL)
     */
    GetPlatformSQL(platform: DatabasePlatform): string;
    private _cacheConfig;
    /**
     * Gets the cache configuration for this query.
     * If the query has no explicit cache config but category inheritance is enabled,
     * walks up the category tree to find inherited cache settings.
     */
    get CacheConfig(): QueryCacheConfig;
    private getInheritedCacheConfig;
}
//# sourceMappingURL=MJQueryEntityExtended.d.ts.map