/**
 * Provides centralized state management using all services and complete type definitions.
 * Coordinates state between Network, Storage, Voice, and Audio services while maintaining
 * expo-speech API compatibility and implementing thread-safe state updates.
 */
import { SpeechOptions, SpeechConfiguration, SpeechError } from "../types";
import { StorageService } from "../services/storageService";
import { NetworkService } from "../services/networkService";
import { VoiceService } from "../services/voiceService";
import { AudioService } from "../services/audioService";
/**
 * Application state enumeration
 */
export declare enum ApplicationState {
    Idle = "idle",
    Initializing = "initializing",
    Ready = "ready",
    Synthesizing = "synthesizing",
    Playing = "playing",
    Paused = "paused",
    Error = "error",
    Cleaning = "cleaning"
}
/**
 * Unified speech synthesis session interface
 * Consolidates the session definitions from synthesizer.ts and state.ts
 */
export interface SynthesisSession {
    /** Session ID */
    id: string;
    /** Connection ID used for this session */
    connectionId: string;
    /** Text being synthesized */
    text: string;
    /** Speech options for this session */
    options: SpeechOptions;
    /** Session state */
    state: ApplicationState;
    /** Creation timestamp */
    createdAt: Date;
    /** Last activity timestamp */
    lastActivity: Date;
    /** Error information if any */
    error?: SpeechError;
    /** Synthesized audio data (optional) */
    audioData?: Uint8Array;
    /** Audio URI for playback (optional) */
    audioUri?: string;
}
/**
 * State change event data
 */
interface StateChangeEvent {
    /** Event type */
    type: "application" | "connection" | "synthesis" | "audio" | "configuration";
    /** Previous state value */
    previousState: any;
    /** New state value */
    newState: any;
    /** Timestamp of the change */
    timestamp: Date;
    /** Optional context data */
    context?: any;
}
/**
 * State change listener callback
 */
export type StateChangeListener = (event: StateChangeEvent) => void;
/**
 * Centralized state management service for expo-edge-speech
 * Coordinates state between all services and provides thread-safe state updates
 */
export declare class StateManager {
    private storageService;
    private networkService;
    private voiceService;
    private audioService;
    private applicationState;
    private configuration;
    private activeSessions;
    private stateChangeListeners;
    private stateUpdateQueue;
    private isProcessingStateUpdates;
    constructor(storageService: StorageService, networkService: NetworkService, voiceService: VoiceService, audioService: AudioService, initialConfiguration?: Partial<SpeechConfiguration>);
    /**
     * Create default configuration using complete constants
     */
    private createDefaultConfiguration;
    /**
     * Get current configuration
     */
    getConfiguration(): SpeechConfiguration;
    /**
     * Update configuration with state change notification
     */
    updateConfiguration(updates: Partial<SpeechConfiguration>): Promise<void>;
    /**
     * Get current application state
     */
    getApplicationState(): ApplicationState;
    /**
     * Update application state with notifications
     */
    private updateApplicationState;
    /**
     * Create new synthesis session using service integration
     */
    createSynthesisSession(text: string, options: SpeechOptions): Promise<SynthesisSession>;
    /**
     * Update synthesis session state
     */
    updateSynthesisSession(sessionId: string, updates: Partial<SynthesisSession>): Promise<void>;
    /**
     * Remove synthesis session and cleanup
     */
    removeSynthesisSession(sessionId: string): Promise<void>;
    /**
     * Get active synthesis sessions
     */
    getActiveSessions(): SynthesisSession[];
    /**
     * Get specific synthesis session
     */
    getSynthesisSession(sessionId: string): SynthesisSession | undefined;
    /**
     * Initialize service integration with state tracking
     */
    private initializeServiceIntegration;
    /**
     * Handle connection state changes from services
     */
    private handleConnectionStateChange;
    /**
     * Handle audio state changes from audio service
     */
    private handleAudioStateChange;
    /**
     * Enqueue state update for thread-safe processing
     */
    private enqueueStateUpdate;
    /**
     * Process queued state updates
     */
    private processStateUpdateQueue;
    /**
     * Add state change listener
     */
    addStateChangeListener(listener: StateChangeListener): void;
    /**
     * Remove state change listener
     */
    removeStateChangeListener(listener: StateChangeListener): void;
    /**
     * Notify all listeners of state change
     */
    private notifyStateChange;
    /**
     * Get comprehensive state summary
     */
    getStateSummary(): {
        application: ApplicationState;
        configuration: SpeechConfiguration;
        activeSessions: number;
        connections: number;
        memoryUsage: any;
    };
    /**
     * Initialize state manager
     */
    initialize(): Promise<void>;
    /**
     * Cleanup state manager and all services
     */
    cleanup(): Promise<void>;
}
export {};
//# sourceMappingURL=state.d.ts.map