/**
 * Capability guards for runtime enforcement.
 *
 * Provides utilities to assert that operations/events/presentations
 * have their required capabilities enabled before execution.
 *
 * @module capabilities/guards
 *
 * @example
 * ```typescript
 * import { assertCapabilityForOperation } from '@contractspec/lib.contracts-spec';
 *
 * // In a handler or middleware
 * assertCapabilityForOperation(ctx, operation);
 * ```
 */
import type { AnyEventSpec } from '../events';
import type { AnyOperationSpec } from '../operations/operation';
import type { PresentationSpec } from '../presentations/presentations';
import type { CapabilityContext } from './context';
/** Result of a capability guard check. */
export interface CapabilityGuardResult {
    /** Whether the guard passed. */
    allowed: boolean;
    /** Missing capability if guard failed. */
    missingCapability?: {
        key: string;
        version: string;
    };
    /** Reason for denial if guard failed. */
    reason?: string;
}
/**
 * Check if an operation's capability is enabled in the context.
 *
 * @param ctx - Capability context to check against
 * @param operation - Operation spec to check
 * @returns Guard result indicating if operation is allowed
 *
 * @example
 * ```typescript
 * const result = checkCapabilityForOperation(ctx, myOperation);
 * if (!result.allowed) {
 *   console.log('Denied:', result.reason);
 * }
 * ```
 */
export declare function checkCapabilityForOperation(ctx: CapabilityContext, operation: AnyOperationSpec): CapabilityGuardResult;
/**
 * Assert that an operation's capability is enabled, throwing if not.
 *
 * @param ctx - Capability context to check against
 * @param operation - Operation spec to check
 * @throws {CapabilityMissingError} If capability is not enabled
 *
 * @example
 * ```typescript
 * // Throws if capability missing
 * assertCapabilityForOperation(ctx, myOperation);
 *
 * // Safe to proceed with operation
 * await handler(input);
 * ```
 */
export declare function assertCapabilityForOperation(ctx: CapabilityContext, operation: AnyOperationSpec): void;
/**
 * Check if an event's capability is enabled in the context.
 *
 * @param ctx - Capability context to check against
 * @param event - Event spec to check
 * @returns Guard result indicating if event is allowed
 */
export declare function checkCapabilityForEvent(ctx: CapabilityContext, event: AnyEventSpec): CapabilityGuardResult;
/**
 * Assert that an event's capability is enabled, throwing if not.
 *
 * @param ctx - Capability context to check against
 * @param event - Event spec to check
 * @throws {CapabilityMissingError} If capability is not enabled
 */
export declare function assertCapabilityForEvent(ctx: CapabilityContext, event: AnyEventSpec): void;
/**
 * Check if a presentation's capability is enabled in the context.
 *
 * @param ctx - Capability context to check against
 * @param presentation - Presentation spec to check
 * @returns Guard result indicating if presentation is allowed
 */
export declare function checkCapabilityForPresentation(ctx: CapabilityContext, presentation: PresentationSpec): CapabilityGuardResult;
/**
 * Assert that a presentation's capability is enabled, throwing if not.
 *
 * @param ctx - Capability context to check against
 * @param presentation - Presentation spec to check
 * @throws {CapabilityMissingError} If capability is not enabled
 */
export declare function assertCapabilityForPresentation(ctx: CapabilityContext, presentation: PresentationSpec): void;
/**
 * Filter operations to only those with enabled capabilities.
 *
 * @param ctx - Capability context to check against
 * @param operations - Operations to filter
 * @returns Operations that have their capabilities enabled (or no capability requirement)
 */
export declare function filterOperationsByCapability(ctx: CapabilityContext, operations: AnyOperationSpec[]): AnyOperationSpec[];
/**
 * Filter events to only those with enabled capabilities.
 *
 * @param ctx - Capability context to check against
 * @param events - Events to filter
 * @returns Events that have their capabilities enabled (or no capability requirement)
 */
export declare function filterEventsByCapability(ctx: CapabilityContext, events: AnyEventSpec[]): AnyEventSpec[];
/**
 * Filter presentations to only those with enabled capabilities.
 *
 * @param ctx - Capability context to check against
 * @param presentations - Presentations to filter
 * @returns Presentations that have their capabilities enabled (or no capability requirement)
 */
export declare function filterPresentationsByCapability(ctx: CapabilityContext, presentations: PresentationSpec[]): PresentationSpec[];
