/**
 * DI Container Types for Declarative Infrastructure API
 *
 * This module defines the interfaces for Dependency Injection container integration.
 * These types are isomorphic and can be used in both Lambda and browser contexts.
 *
 * @module declarative-api/di-container.types
 */
import type { IResourceRepository } from './repository.types';
import type { IEventBusMediator } from './mediator.types';
import type { IResourceObserver } from './observer.types';
import type { IIntegrationStrategy } from './strategy.types';
import type { IPermissionChain } from './permission-chain.types';
import type { IResourceDecorator } from './decorator.types';
import type { ICommandExecutor } from './command.types';
import type { IDynamoDbResourceFactory, IMessagingResourceFactory, IAuthResourceFactory, IStorageResourceFactory, IEventsResourceFactory, IResourceFactoryRegistry } from './factory.types';
import type { IResourceAdapterRegistry } from './adapter.types';
import type { IDecoratorRegistry } from './decorator.types';
import type { IObserverRegistry } from './observer.types';
/**
 * DI Scope type.
 *
 * Defines the lifecycle of a dependency:
 * - Singleton: Same instance for all resolutions within the container
 * - Transient: New instance for each resolution
 * - Scoped: Same instance within a scope (e.g., per-stack)
 */
export type DIScope = 'Singleton' | 'Transient' | 'Scoped';
/**
 * All valid DI scope values.
 */
export declare const DI_SCOPES: readonly DIScope[];
/**
 * Type guard to check if a value is a valid DIScope.
 *
 * @param value - The value to check
 * @returns True if the value is a valid DIScope
 */
export declare function isValidDIScope(value: unknown): value is DIScope;
/**
 * Binding identifier type.
 *
 * Used to identify bindings in the DI container.
 */
export type BindingId = string | symbol;
/**
 * Binding configuration for a single dependency.
 *
 * @typeParam T - The type of the dependency
 */
export interface DIBinding<T = unknown> {
    /** Unique identifier for the binding */
    readonly id: BindingId;
    /** The scope of the binding */
    readonly scope: DIScope;
    /** Factory function to create the instance */
    readonly factory: () => T;
    /** Optional description for debugging */
    readonly description?: string;
    /** Whether this binding can be overridden */
    readonly overridable?: boolean;
}
/**
 * Binding override configuration.
 *
 * Used to override default bindings with custom implementations.
 *
 * @typeParam T - The type of the dependency
 */
export interface DIBindingOverride<T = unknown> {
    /** The binding ID to override */
    readonly id: BindingId;
    /** New factory function */
    readonly factory: () => T;
    /** Optional new scope (defaults to original scope) */
    readonly scope?: DIScope;
}
/**
 * Resolution result from the DI container.
 *
 * @typeParam T - The type of the resolved dependency
 */
export interface DIResolutionResult<T = unknown> {
    /** Whether the resolution was successful */
    readonly success: boolean;
    /** The resolved instance (if successful) */
    readonly instance?: T;
    /** Error message (if failed) */
    readonly error?: string;
    /** The binding ID that was resolved */
    readonly bindingId: BindingId;
    /** The scope of the resolved binding */
    readonly scope: DIScope;
}
/**
 * Infrastructure DI Bindings interface.
 *
 * Defines all the default bindings for the declarative infrastructure API.
 * All factories, builders, strategies, observers, and decorators are injectable
 * through this interface.
 *
 * Validates: Requirements 17.1, 17.2
 */
export interface InfrastructureDIBindings {
    readonly dynamoDbFactory: IDynamoDbResourceFactory;
    readonly messagingFactory: IMessagingResourceFactory;
    readonly authFactory: IAuthResourceFactory;
    readonly storageFactory: IStorageResourceFactory;
    readonly eventsFactory: IEventsResourceFactory;
    readonly factoryRegistry: IResourceFactoryRegistry;
    readonly fullAccessStrategy: IIntegrationStrategy;
    readonly readOnlyStrategy: IIntegrationStrategy;
    readonly writeOnlyStrategy: IIntegrationStrategy;
    readonly autoGrantObserver: IResourceObserver;
    readonly autoInjectObserver: IResourceObserver;
    readonly loggingObserver: IResourceObserver;
    readonly metricsObserver: IResourceObserver;
    readonly observerRegistry: IObserverRegistry;
    readonly taggingDecorator: IResourceDecorator;
    readonly loggingDecorator: IResourceDecorator;
    readonly metricsDecorator: IResourceDecorator;
    readonly encryptionDecorator: IResourceDecorator;
    readonly decoratorRegistry: IDecoratorRegistry;
    readonly repository: IResourceRepository;
    readonly mediator: IEventBusMediator;
    readonly permissionChain: IPermissionChain;
    readonly commandExecutor: ICommandExecutor;
    readonly adapterRegistry: IResourceAdapterRegistry;
}
/**
 * Binding keys for infrastructure DI bindings.
 *
 * These symbols are used to identify bindings in the DI container.
 */
export declare const INFRASTRUCTURE_BINDING_KEYS: {
    readonly DYNAMODB_FACTORY: symbol;
    readonly MESSAGING_FACTORY: symbol;
    readonly AUTH_FACTORY: symbol;
    readonly STORAGE_FACTORY: symbol;
    readonly EVENTS_FACTORY: symbol;
    readonly FACTORY_REGISTRY: symbol;
    readonly FULL_ACCESS_STRATEGY: symbol;
    readonly READ_ONLY_STRATEGY: symbol;
    readonly WRITE_ONLY_STRATEGY: symbol;
    readonly AUTO_GRANT_OBSERVER: symbol;
    readonly AUTO_INJECT_OBSERVER: symbol;
    readonly LOGGING_OBSERVER: symbol;
    readonly METRICS_OBSERVER: symbol;
    readonly OBSERVER_REGISTRY: symbol;
    readonly TAGGING_DECORATOR: symbol;
    readonly LOGGING_DECORATOR: symbol;
    readonly METRICS_DECORATOR: symbol;
    readonly ENCRYPTION_DECORATOR: symbol;
    readonly DECORATOR_REGISTRY: symbol;
    readonly REPOSITORY: symbol;
    readonly MEDIATOR: symbol;
    readonly PERMISSION_CHAIN: symbol;
    readonly COMMAND_EXECUTOR: symbol;
    readonly ADAPTER_REGISTRY: symbol;
};
/**
 * Type for binding key values.
 */
export type InfrastructureBindingKey = (typeof INFRASTRUCTURE_BINDING_KEYS)[keyof typeof INFRASTRUCTURE_BINDING_KEYS];
/**
 * DI Container interface for infrastructure components.
 *
 * Provides methods for registering, resolving, and managing dependencies.
 * Supports scopes (Singleton, Transient, Scoped) and binding overrides.
 *
 * Validates: Requirements 17.2, 17.3, 17.4, 17.5
 */
export interface IInfrastructureDIContainer {
    /**
     * Register a binding in the container.
     *
     * @typeParam T - The type of the dependency
     * @param binding - The binding configuration
     * @throws Error if binding already exists and is not overridable
     */
    register<T>(binding: DIBinding<T>): void;
    /**
     * Register multiple bindings at once.
     *
     * @param bindings - Array of binding configurations
     */
    registerAll(bindings: DIBinding[]): void;
    /**
     * Override an existing binding.
     *
     * @typeParam T - The type of the dependency
     * @param override - The override configuration
     * @throws Error if original binding doesn't exist or is not overridable
     */
    override<T>(override: DIBindingOverride<T>): void;
    /**
     * Resolve a dependency by its binding ID.
     *
     * @typeParam T - The expected type of the dependency
     * @param id - The binding ID to resolve
     * @returns The resolved instance
     * @throws DIResolutionError if binding not found or resolution fails
     */
    resolve<T>(id: BindingId): T;
    /**
     * Try to resolve a dependency, returning null if not found.
     *
     * @typeParam T - The expected type of the dependency
     * @param id - The binding ID to resolve
     * @returns The resolved instance or null
     */
    tryResolve<T>(id: BindingId): T | null;
    /**
     * Resolve a dependency with detailed result.
     *
     * @typeParam T - The expected type of the dependency
     * @param id - The binding ID to resolve
     * @returns The resolution result with success/error information
     */
    resolveWithResult<T>(id: BindingId): DIResolutionResult<T>;
    /**
     * Check if a binding exists.
     *
     * @param id - The binding ID to check
     * @returns True if the binding exists
     */
    has(id: BindingId): boolean;
    /**
     * Get all registered binding IDs.
     *
     * @returns Array of all binding IDs
     */
    getBindingIds(): BindingId[];
    /**
     * Get the scope of a binding.
     *
     * @param id - The binding ID
     * @returns The scope of the binding, or undefined if not found
     */
    getScope(id: BindingId): DIScope | undefined;
    /**
     * Create a child scope.
     *
     * Child scopes inherit parent bindings but can have their own
     * scoped instances. Useful for per-stack isolation.
     *
     * @param scopeId - Optional identifier for the scope
     * @returns A new child container
     */
    createScope(scopeId?: string): IInfrastructureDIContainer;
    /**
     * Dispose of the container and all scoped instances.
     *
     * Calls dispose() on any instances that implement IDisposable.
     */
    dispose(): void;
    /**
     * Get all bindings for debugging/introspection.
     *
     * @returns Map of binding ID to binding configuration
     */
    getBindings(): Map<BindingId, DIBinding>;
}
/**
 * Options for creating an infrastructure DI container.
 */
export interface InfrastructureDIContainerOptions {
    /** Default scope for bindings without explicit scope */
    readonly defaultScope?: DIScope;
    /** Parent container for scope inheritance */
    readonly parent?: IInfrastructureDIContainer;
    /** Scope identifier for scoped bindings */
    readonly scopeId?: string;
    /** Whether to register default bindings */
    readonly registerDefaults?: boolean;
}
/**
 * Factory function type for creating DI containers.
 */
export type InfrastructureDIContainerFactory = (options?: InfrastructureDIContainerOptions) => IInfrastructureDIContainer;
/**
 * Disposable interface for cleanup.
 */
export interface IDisposable {
    dispose(): void;
}
/**
 * Type guard to check if an object is disposable.
 *
 * @param obj - The object to check
 * @returns True if the object has a dispose method
 */
export declare function isDisposable(obj: unknown): obj is IDisposable;
