import type { CloudFormationStackState, DestroyResult, RetainedResource } from './types';
import { type BuildCredentials } from '../../commands/credentials';
import type { Logger } from '../../types/cli.types';
import { RuntimeConfig } from '../../../utils/types';
export type { Logger };
/**
 * Service for orchestrating AWS CDK stack destruction
 * Handles CloudFormation stack operations including existence checks,
 * state retrieval, and destruction with retry logic
 */
export declare class DestroyService {
    private readonly cwd;
    private readonly logger;
    private readonly verbose;
    private readonly DEFAULT_CDK_DIR;
    private readonly defaultRetryConfig;
    private readonly errorHandler;
    constructor(cwd: string | undefined, logger: Logger, verbose?: boolean);
    /**
     * Log debug message only if verbose mode is enabled
     */
    private debug;
    /**
     * Check if a CloudFormation stack exists
     * Uses the same AWS credentials and region as the destroy operation
     *
     * @param stackName - CloudFormation stack name
     * @param region - AWS region
     * @param awsProfile - Optional AWS profile name
     * @returns true if stack exists, false otherwise
     */
    stackExists(stackName: string, region: string, awsProfile?: string): Promise<boolean>;
    /**
     * Get the current state of a CloudFormation stack
     *
     * @param stackName - CloudFormation stack name
     * @param region - AWS region
     * @param awsProfile - Optional AWS profile name
     * @returns Stack state or null if stack doesn't exist
     */
    getStackState(stackName: string, region: string, awsProfile?: string): Promise<CloudFormationStackState | null>;
    /**
     * Wait for a stack to reach a stable state
     * Polls the stack state until it's no longer in a transition state
     *
     * @param stackName - CloudFormation stack name
     * @param region - AWS region
     * @param awsProfile - Optional AWS profile name
     * @param timeoutMs - Maximum time to wait in milliseconds (default: 10 minutes)
     * @returns Final stable state
     * @throws Error if timeout is reached or stack doesn't exist
     */
    waitForStackStable(stackName: string, region: string, awsProfile?: string, timeoutMs?: number): Promise<CloudFormationStackState>;
    /**
     * Validate AWS credentials before destruction
     * Uses the same validation mechanism as the deploy command
     * Supports AWS_PROFILE environment variable and profile from stage configuration
     *
     * @param stageConfig - Stage configuration with optional profile
     * @returns Validated credentials with region and account information
     * @throws Error if credentials are invalid or missing, or if profile doesn't exist
     */
    validateCredentials(stageConfig: {
        awsRegion?: string;
        awsProfile?: string;
    }): Promise<BuildCredentials>;
    /**
     * Destroy a specific CDK stack
     * Uses CDK CLI to destroy the stack with retry logic for throttling
     * For stacks in DELETE_FAILED state, uses AWS CLI force delete if --force-delete flag is set
     *
     * @param stackName - CloudFormation stack name
     * @param stage - Deployment stage
     * @param region - AWS region
     * @param config
     * @param options - Destruction options
     * @returns Destruction result with timing information
     */
    destroyStack(stackName: string, stage: string, region: string, config: RuntimeConfig, options?: {
        forceDelete?: boolean;
        awsProfile?: string;
    }): Promise<DestroyResult>;
    /**
     * Resolve CDK directory path from configuration
     */
    private resolveCdkDirectory;
    /**
     * Get resources that will be retained after stack deletion
     * Queries CloudFormation for resources with DeletionPolicy: Retain
     *
     * @param stackName - CloudFormation stack name
     * @param region - AWS region
     * @param awsProfile - Optional AWS profile name
     * @returns List of retained resources
     */
    getRetainedResources(stackName: string, region: string, awsProfile?: string): Promise<RetainedResource[]>;
    /**
     * Discover stacks across all regions
     * Queries CloudFormation in each region to find stacks matching the project and stage
     *
     * @param projectName - Project name from configuration
     * @param stage - Deployment stage
     * @returns Map of region to stack names
     */
    discoverStacksInAllRegions(projectName: string, stage: string): Promise<Map<string, string[]>>;
    /**
     * Get all AWS regions
     * Uses EC2 DescribeRegions API to get the list of all available regions
     *
     * @returns List of AWS region names
     */
    private getAllRegions;
    /**
     * Discover stacks in a specific region
     * Checks for existence of Infra, Runtime, and RuntimeWeb stacks
     *
     * @param projectName - Project name from configuration
     * @param stage - Deployment stage
     * @param region - AWS region to check
     * @returns List of stack names that exist in the region
     */
    private discoverStacksInRegion;
    /**
     * Execute CDK destroy command
     * Spawns a child process to run the CDK CLI
     *
     * @param stackName - CloudFormation stack name
     * @param stage - Deployment stage
     * @param region - AWS region
     * @param config
     * @param awsProfile - Optional AWS profile name
     */
    private executeCdkDestroy;
    /**
     * Force delete a stack in DELETE_FAILED state using AWS CLI
     * This bypasses normal CloudFormation deletion and forces removal
     *
     * @param stackName - CloudFormation stack name
     * @param region - AWS region
     * @param awsProfile - Optional AWS profile name
     * @throws Error if force delete fails
     */
    private executeForceDelete;
    /**
     * Retry an operation with exponential backoff
     * Implements retry logic for handling AWS API throttling
     *
     * @param operation - Async operation to retry
     * @param config - Retry configuration
     * @returns Result of the operation
     * @throws Last error if all retries are exhausted
     */
    private withRetry;
    /**
     * Validate stack state before attempting destruction
     * Throws appropriate errors for states that cannot be destroyed
     */
    private validateStackStateForDestruction;
    /**
     * Check if error is a credential-related error
     */
    private isCredentialError;
    /**
     * Check if error is a network-related error
     */
    private isNetworkError;
    /**
     * Create a CloudFormation client with the specified region and profile
     *
     * @param region - AWS region
     * @param awsProfile - Optional AWS profile name
     * @returns CloudFormation client
     */
    private createCloudFormationClient;
}
