import { PureContainer } from '@worktif/utils';
import type { LambdaDefinition } from '../../../lib/runtime-web/types';
import type { DependencyMetadata } from '../metadata/dependency-metadata.types';
/**
 * Validation report for container state.
 *
 * Contains comprehensive information about container validation results
 * including any issues found during validation.
 */
export interface ValidationReport {
    /** Whether validation passed */
    isValid: boolean;
    /** Total number of services registered in container */
    serviceCount: number;
    /** Total number of Lambda definitions validated */
    lambdaCount: number;
    /** Container initialization timestamp */
    initializationTime: number;
    /** Array of validation error messages */
    errors: string[];
    /** Array of validation warning messages */
    warnings: string[];
    /** Array of services available in container */
    availableServices: string[];
    /** Array of Lambda IDs that were validated */
    validatedLambdas: string[];
    /** Array of circular dependency chains found */
    circularDependencies: CircularDependency[];
    /** Array of missing dependencies */
    missingDependencies: MissingDependency[];
}
/**
 * Information about a circular dependency chain.
 */
export interface CircularDependency {
    /** Array of service names forming the circular chain */
    chain: string[];
    /** Hash keys involved in the circular dependency */
    hashKeys: string[];
}
/**
 * Information about a missing dependency.
 */
export interface MissingDependency {
    /** Lambda ID that requires the missing dependency */
    lambdaId: string;
    /** Name of the missing service */
    serviceName: string;
    /** Hash key of the missing service */
    hashKey: string;
    /** Array of available services for suggestions */
    availableServices: string[];
}
/**
 * Container state validator for DI container lifecycle management.
 *
 * Ensures container is fully initialized and all Lambda dependencies are available
 * before handler execution. Provides comprehensive validation and diagnostic
 * capabilities for troubleshooting container issues.
 */
export declare class ContainerStateValidator {
    /**
     * Validate that container is fully initialized.
     *
     * Checks that the container is in a valid state and ready for service resolution.
     * This includes verifying that the container exists, has services registered,
     * and is properly configured.
     *
     * @param container - PureContainer to validate
     * @throws DIContainerError if container is not properly initialized
     */
    validateInitialization(container: PureContainer<string>): void;
    /**
     * Validate that all Lambda dependencies are available in the container.
     *
     * Checks each Lambda definition's ties (array or object format) against container contents
     * to ensure all required dependencies can be resolved. Supports both legacy array-based
     * and new object-based ties formats.
     *
     * @param container - PureContainer to validate against
     * @param lambdaDefinitions - Array of Lambda definitions to validate (supports both formats)
     * @throws MissingServiceError if any required dependency is not available
     */
    validateLambdaDependencies(container: PureContainer<string>, lambdaDefinitions: (LambdaDefinition | any)[]): void;
    /**
     * Type guard to check if ties is object-based format.
     *
     * @param ties - Ties definition to check
     * @returns True if ties is object-based, false if array-based or invalid
     */
    private isObjectBasedTies;
    /**
     * Validate object-based dependencies using property names as keys.
     *
     * @param container - PureContainer to validate against
     * @param lambdaDef - Lambda definition with object-based ties
     * @throws Error if any dependency cannot be resolved
     */
    private validateObjectBasedDependencies;
    /**
     * Validate array-based dependencies using hash-based keys (legacy).
     *
     * @param container - PureContainer to validate against
     * @param lambdaDef - Lambda definition with array-based ties
     * @throws Error if any dependency cannot be resolved
     */
    private validateArrayBasedDependencies;
    /**
     * Compute hash key for a service class.
     */
    private computeServiceHashKey;
    /**
     * Resolves and retrieves service dependencies from the provided container based on multiple resolution strategies,
     * including hash-based keys, camelCase class names, and original class names. Throws an error if any dependency cannot be resolved.
     *
     * @param {PureContainer<string>} container - The container instance from which services will be resolved.
     * @param {TiesInstance[]} tiesClasses - An array of service classes (ties) to resolve dependencies for.
     * @return {Record<string, any>} A record containing resolved dependencies keyed by their hash-based identifiers.
     *
     * @note: 27/12/2025: PROBLEM – DI Container is EMPTY!!!
     *        --> Potentially resolved by registrar to MicroserviceBundle relations
     *        ------- RESOLVED -------
     */
    private resolveDependencies;
    /**
     * Detect circular dependencies in dependency metadata.
     *
     * Analyzes dependency relationships to find circular dependency chains
     * that could cause infinite loops during service resolution.
     *
     * @param metadata - Array of dependency metadata to analyze
     * @throws DIContainerError if circular dependencies are found
     */
    detectCircularDependencies(metadata: DependencyMetadata[]): void;
    /**
     * Generate comprehensive validation report.
     *
     * Creates a detailed report of container state including service counts,
     * validation results, and diagnostic information.
     *
     * @param container - PureContainer to analyze
     * @param lambdaDefinitions - Optional Lambda definitions to validate
     * @param metadata - Optional dependency metadata for circular dependency detection
     * @returns Comprehensive validation report
     */
    generateValidationReport(container: PureContainer<string>, lambdaDefinitions?: LambdaDefinition[], metadata?: DependencyMetadata[]): ValidationReport;
    /**
     * Get array of available service names from container.
     *
     * @param container - PureContainer to inspect
     * @returns Array of service names available in container
     */
    private getAvailableServices;
    /**
     * Test container functionality to ensure it's working properly.
     *
     * @param container - PureContainer to test
     * @returns Test result with success status and error message
     */
    private testContainerFunctionality;
    /**
     * Get Lambda ID from definition.
     *
     * @param lambdaDef - Lambda definition
     * @returns Lambda ID string
     */
    private getLambdaId;
    /**
     * Extract missing dependencies from Lambda definitions.
     *
     * @param container - PureContainer to check against
     * @param lambdaDefinitions - Lambda definitions to analyze
     * @returns Array of missing dependencies
     */
    private extractMissingDependencies;
    /**
     * Find circular dependencies in metadata.
     *
     * @param metadata - Array of dependency metadata to analyze
     * @returns Array of circular dependencies found
     */
    private findCircularDependencies;
}
