/**
 * Infrastructure Context Implementation (Aggregate Root)
 *
 * This module provides the Infrastructure Context implementation,
 * which serves as the Aggregate Root for all infrastructure resources.
 *
 * IMPORTANT: RuntimeInfraStack is now REQUIRED. Standalone mode is no longer supported.
 * All resource creation must flow through the framework abstraction layer.
 *
 * @module declarative-api/infrastructure-context/infrastructure-context
 */
import type { Stage, IResourceEntity, IResourceRepository, IEventBusMediator, IResourceFactoryRegistry, IObserverRegistry, IPermissionChain, ICommandExecutor, IDecoratorRegistry, IUnitOfWork, IInfrastructureContext, InfrastructureContextOptions, ResourceCreationResult, IResourceBuilder, IRuntimeInfraStackReference } from '../../../lib/runtime-web/types/declarative-api';
import type { IFrameworkResourceProvider } from '../../interfaces';
/**
 * Error thrown when an Infrastructure Context operation fails.
 */
export declare class InfrastructureContextError extends Error {
    readonly contextId: string;
    readonly code: string;
    constructor(message: string, contextId: string);
}
/**
 * Type guard for InfrastructureContextError.
 */
export declare function isInfrastructureContextError(error: unknown): error is InfrastructureContextError;
/**
 * Error thrown when a resource already exists in the context.
 */
export declare class ResourceAlreadyExistsError extends InfrastructureContextError {
    readonly resourceId: string;
    readonly code = "RESOURCE_ALREADY_EXISTS";
    constructor(resourceId: string, contextId: string);
}
/**
 * Type guard for ResourceAlreadyExistsError.
 */
export declare function isResourceAlreadyExistsError(error: unknown): error is ResourceAlreadyExistsError;
/**
 * Infrastructure Context implementation (Aggregate Root).
 *
 * The Infrastructure Context is the single entry point for managing all
 * infrastructure resources. It encapsulates all resource entities and
 * provides consistency guarantees through the Aggregate Root pattern.
 *
 * IMPORTANT: RuntimeInfraStack is now REQUIRED. Standalone mode is no longer supported.
 * All resource creation must flow through the framework abstraction layer.
 *
 * Implements: DDD Aggregate Root, Unit of Work
 * Validates: Requirements 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 6.2, 6.3, 6.5
 */
export declare class InfrastructureContext implements IInfrastructureContext {
    readonly contextId: string;
    readonly serviceName: string;
    readonly stage: Stage;
    /**
     * Reference to RuntimeInfraStack (REQUIRED).
     * Exposes the infraStack for direct access when needed.
     *
     * Validates: Requirements 6.5
     */
    readonly infraStack: IRuntimeInfraStackReference;
    /**
     * Framework Resource Provider adapter.
     * Created from infraStack if it implements IFrameworkResourceProvider.
     * Used by factories for resource creation.
     *
     * Validates: Requirements 6.3
     */
    readonly frameworkProvider?: IFrameworkResourceProvider;
    readonly factories: IResourceFactoryRegistry;
    readonly repository: IResourceRepository;
    readonly mediator: IEventBusMediator;
    readonly observers: IObserverRegistry;
    readonly permissionChain: IPermissionChain;
    readonly commandExecutor: ICommandExecutor;
    readonly decorators: IDecoratorRegistry;
    private readonly observerNotifier;
    private readonly debug;
    /**
     * Create a new Infrastructure Context.
     *
     * @param options - Context configuration options
     * @throws ConfigurationError if infraStack is not provided
     *
     * Validates: Requirements 6.2
     */
    constructor(options: InfrastructureContextOptions);
    /**
     * Create a resource through a builder.
     */
    createResource<T extends IResourceEntity>(builder: IResourceBuilder<T, unknown>): ResourceCreationResult<T>;
    /**
     * Register an existing resource in the context.
     */
    registerResource(resource: IResourceEntity): void;
    /**
     * Begin a new Unit of Work transaction.
     */
    beginTransaction(): IUnitOfWork;
    /**
     * Commit all pending commands.
     */
    commit(): IResourceEntity[];
    /**
     * Rollback all executed commands.
     */
    rollback(): void;
    /**
     * Generate a resource name following naming conventions.
     */
    resourceName(baseName: string): string;
    /**
     * Check if a resource exists in the context.
     */
    hasResource(resourceId: string): boolean;
    /**
     * Get the count of resources in the context.
     */
    getResourceCount(): number;
    /**
     * Clear all resources from the context.
     */
    clear(): void;
    /**
     * Set up event subscriptions for observer notification.
     */
    private setupEventSubscriptions;
}
/**
 * Create a new Infrastructure Context with the required RuntimeInfraStack.
 *
 * IMPORTANT: infraStack is now REQUIRED. Standalone mode is no longer supported.
 * All resource creation must flow through the framework abstraction layer.
 *
 * @param options - Context configuration options including required infraStack
 * @returns A new Infrastructure Context instance
 * @throws ConfigurationError if infraStack is not provided
 *
 * @example
 * ```typescript
 * const infraStack = new RuntimeInfraStack(app, 'Infra', {
 *   stage: 'dev',
 *   serviceName: 'my-service',
 * });
 *
 * const context = createInfrastructureContext({
 *   infraStack,
 *   serviceName: 'my-service', // Optional, defaults to infraStack.serviceName
 *   stage: 'dev', // Optional, defaults to infraStack.stage
 * });
 * ```
 *
 * Validates: Requirements 6.6
 */
export declare function createInfrastructureContext(options: InfrastructureContextOptions): IInfrastructureContext;
