import { PureContainer } from '@worktif/utils';
import type { TiesInstance } from '../../../lib/runtime-web/types';
/**
 * Service scope types supported by the container.
 */
export type ServiceScope = 'singleton' | 'transient';
/**
 * Service lifecycle interface for cleanup operations.
 */
export interface ServiceLifecycle {
    /**
     * Called when the service is being disposed.
     * Implement this method to perform cleanup operations.
     */
    dispose?(): void | Promise<void>;
}
/**
 * Service registration information with scope details.
 */
export interface ServiceRegistration {
    serviceName: string;
    scope: ServiceScope;
    instance?: any;
    factory?: () => any;
    registeredAt: number;
    accessCount: number;
    lastAccessed: number;
}
/**
 * Container scope configuration options.
 */
export interface ScopeConfiguration {
    defaultScope: ServiceScope;
    enableLifecycleManagement: boolean;
    enableAccessTracking: boolean;
}
/**
 * Container Scope Manager handles service scope configuration and lifecycle management.
 *
 * Provides proper service scope configuration (singleton by default), scope validation,
 * and service cleanup and disposal mechanisms. Ensures that services are created and
 * destroyed appropriately across Lambda invocations.
 *
 * Key responsibilities:
 * - Configure singleton scope as default for all services
 * - Respect scope configuration from Ties classes
 * - Return same instance for singleton services across resolutions
 * - Create new instances for transient services on each resolution
 * - Properly dispose of services that implement cleanup interfaces
 * - Validate scope configuration consistency with service design
 *
 * @example
 * ```typescript
 * const scopeManager = new ContainerScopeManager();
 * const container = scopeManager.createScopedContainer([PaymentsTies]);
 *
 * // Singleton services return same instance
 * const service1 = container.run('PaymentsService');
 * const service2 = container.run('PaymentsService');
 * console.log(service1 === service2); // true for singleton
 * ```
 */
export declare class ContainerScopeManager {
    private readonly serviceRegistrations;
    private readonly cleanupHooks;
    private readonly scopeConfiguration;
    constructor(configuration?: Partial<ScopeConfiguration>);
    /**
     * Create a PureContainer with proper scope configuration.
     *
     * Creates a container with singleton scope as the default and configures
     * it for proper service lifecycle management.
     *
     * @param tiesClasses - Ties classes to register with the container
     * @param customScope - Optional custom default scope
     * @returns Configured PureContainer with scope management
     * @throws DIContainerError if container creation fails
     */
    createScopedContainer(tiesClasses?: TiesInstance[], customScope?: ServiceScope): PureContainer<string>;
    /**
     * Register Ties classes with scope tracking and validation.
     *
     * @param container - Container to register services with
     * @param tiesClasses - Ties classes to register
     */
    private registerTiesWithScopeTracking;
    /**
     * Validate service scope configuration.
     *
     * Ensures that all services are properly configured with appropriate scopes
     * and that scope configuration is consistent with service design.
     *
     * @param container - Container to validate
     * @param expectedServices - Expected service configurations
     * @throws DIContainerError if scope validation fails
     */
    validateServiceScopes(container: PureContainer<string>, expectedServices?: Array<{
        name: string;
        expectedScope: ServiceScope;
    }>): void;
    /**
     * Validate that a specific service has the expected scope behavior.
     *
     * @param container - Container to test
     * @param serviceName - Name of service to validate
     * @param expectedScope - Expected scope behavior
     */
    private validateServiceScope;
    /**
     * Register a cleanup hook for graceful service shutdown.
     *
     * @param cleanup - Cleanup function to register
     */
    registerCleanupHook(cleanup: () => void | Promise<void>): void;
    /**
     * Perform graceful cleanup of all registered services.
     *
     * Calls dispose() on services that implement ServiceLifecycle interface
     * and executes all registered cleanup hooks.
     */
    performServiceCleanup(): Promise<void>;
    /**
     * Get service registration information.
     *
     * @param serviceName - Name of service to get info for
     * @returns Service registration info or undefined if not tracked
     */
    getServiceRegistration(serviceName: string): ServiceRegistration | undefined;
    /**
     * Get all service registrations.
     *
     * @returns Map of all service registrations
     */
    getAllServiceRegistrations(): Map<string, ServiceRegistration>;
    /**
     * Get scope configuration.
     *
     * @returns Current scope configuration
     */
    getScopeConfiguration(): ScopeConfiguration;
    /**
     * Get container service count (helper method).
     *
     * @param container - Container to count services in
     * @returns Number of registered services
     */
    private getContainerServiceCount;
    /**
     * Track Ties class registration.
     *
     * @param tiesClassName - Name of Ties class
     * @param servicesCount - Number of services registered
     */
    private trackTiesClassRegistration;
    /**
     * Validate container scope configuration.
     *
     * Validates that the container is properly configured with singleton scope
     * as default and that all service scopes are consistent.
     *
     * @param container - Container to validate
     * @throws DIContainerError if scope configuration is invalid
     */
    validateContainerScopeConfiguration(container: PureContainer<string>): void;
    /**
     * Register cleanup hook for lifecycle manager integration.
     *
     * @param cleanup - Cleanup function to register
     */
    registerLifecycleCleanupHook(cleanup: () => void | Promise<void>): void;
    /**
     * Get scope manager configuration for diagnostics.
     *
     * @returns Scope configuration and statistics
     */
    getScopeManagerDiagnostics(): {
        configuration: ScopeConfiguration;
        registrations: Map<string, ServiceRegistration>;
        cleanupHooksCount: number;
    };
}
