"""Services package for Trax platform."""

# Import all protocols from the centralized protocols module
from .protocols import (
    # Main service protocols
    YouTubeServiceProtocol,
    MediaServiceProtocol,
    TranscriptionServiceProtocol,
    EnhancementServiceProtocol,
    ExportServiceProtocol,
    BatchProcessorProtocol,
    
    # Specialized protocols
    MediaDownloadProtocol,
    MediaPreprocessingProtocol,
    MediaDatabaseProtocol,
    
    # Data types and enums
    TranscriptionStatus,
    ExportFormat,
    TranscriptionConfig,
    TranscriptionResult,
    EnhancementResult,
    ExportResult,
    BatchTask,
    BatchProgress,
    
    # Utility functions
    validate_protocol_implementation,
    get_missing_methods,
)

# Import factory functions for service instantiation
from .factories import (
    create_youtube_service,
    create_media_service,
    create_transcription_service,
    create_enhancement_service,
    create_export_service,
    create_batch_processor,
    create_service_container,
    create_minimal_service_container,
    validate_service_container,
    get_service_dependencies,
)

# Import mock services for testing
from .mocks import (
    create_mock_youtube_service,
    create_mock_media_service,
    create_mock_transcription_service,
    create_mock_enhancement_service,
    create_mock_export_service,
    create_mock_batch_processor,
    create_mock_service_container,
)

# Import existing types for backward compatibility
from .media_types import (
    MediaStatus,
    MediaError,
    DownloadError,
    PreprocessingError,
    ValidationError,
    DownloadProgress,
    ProcessingProgress,
    MediaFileInfo,
    TelemetryData,
    ProgressCallback,
)

# Import concrete service implementations
from .media_service import MediaService, create_media_service as create_media_service_old
from .media_download import MediaDownloadService
from .media_preprocessing import MediaPreprocessingService
from .media_database import MediaDatabaseService
from .media_pipeline import MediaPipelineService
from .media_telemetry import MediaTelemetry, ProgressTracker
from .youtube_service import YouTubeMetadataService
from .export_service import (
    ExportService,
    ExportFormat as ExportFormatEnum,  # Rename to avoid conflict
    ExportError,
    format_timestamp,
    format_duration,
    convert_to_srt,
    convert_to_markdown,
)
from .batch_processor import (
    BatchProcessor,
    BatchTask as BatchTaskClass,  # Rename to avoid conflict
    BatchProgress as BatchProgressClass,  # Rename to avoid conflict
    TaskType,
    create_batch_processor as create_batch_processor_old,  # Keep old for compatibility
    BatchProcessorProtocol as BatchProcessorProtocolOld,  # Keep old for compatibility
)

# Import performance optimization services
from .performance import (
    ResourceMonitor,
    SystemResources,
    PerformanceMetrics,
    M3OptimizationConfig,
    ResourceThresholds,
    ResourceMonitorProtocol,
    create_resource_monitor,
)

from .performance_optimizer import (
    PerformanceOptimizer,
    PerformanceOptimizerProtocol,
    create_performance_optimizer,
)

from .ffmpeg_optimizer import (
    FFmpegOptimizer,
    FFmpegOptimizerProtocol,
    create_ffmpeg_optimizer,
)

from .performance_benchmarker import (
    PerformanceBenchmarker,
    PerformanceStatistics,
    PerformanceBenchmarkerProtocol,
    create_performance_benchmarker,
)

from .database_optimizer import (
    DatabaseOptimizer,
    DatabaseOptimizerProtocol,
    create_database_optimizer,
)

# Import quality assessment services
from .quality_assessment import (
    QualityAssessor,
    QualityMetrics,
    QualityWarning,
    WarningSeverity,
    QualityAssessorProtocol,
    create_quality_assessor,
)

from .confidence_scorer import (
    ConfidenceScorer,
    SegmentConfidence,
    ConfidenceLevel,
    ConfidenceScorerProtocol,
    create_confidence_scorer,
)

from .transcript_comparer import (
    TranscriptComparer,
    SegmentChange,
    ComparisonResult,
    ChangeType,
    TranscriptComparerProtocol,
    create_transcript_comparer,
)

__all__ = [
    # Main service protocols
    "YouTubeServiceProtocol",
    "MediaServiceProtocol",
    "TranscriptionServiceProtocol",
    "EnhancementServiceProtocol",
    "ExportServiceProtocol",
    "BatchProcessorProtocol",
    
    # Specialized protocols
    "MediaDownloadProtocol",
    "MediaPreprocessingProtocol",
    "MediaDatabaseProtocol",
    
    # Data types and enums
    "TranscriptionStatus",
    "ExportFormat",
    "TranscriptionConfig",
    "TranscriptionResult",
    "EnhancementResult",
    "ExportResult",
    "BatchTask",
    "BatchProgress",
    
    # Utility functions
    "validate_protocol_implementation",
    "get_missing_methods",
    
    # Factory functions
    "create_youtube_service",
    "create_media_service",
    "create_transcription_service",
    "create_enhancement_service",
    "create_export_service",
    "create_batch_processor",
    "create_service_container",
    "create_minimal_service_container",
    "validate_service_container",
    "get_service_dependencies",
    
    # Main media service
    "MediaService",
    "create_media_service_old",
    
    # Media types and protocols (backward compatibility)
    "MediaStatus",
    "MediaError",
    "DownloadError",
    "PreprocessingError",
    "ValidationError",
    "DownloadProgress",
    "ProcessingProgress",
    "MediaFileInfo",
    "TelemetryData",
    "ProgressCallback",
    
    # Specialized services
    "MediaDownloadService",
    "MediaPreprocessingService",
    "MediaDatabaseService",
    "MediaPipelineService",
    "MediaTelemetry",
    "ProgressTracker",
    
    # YouTube service
    "YouTubeMetadataService",
    
    # Export service
    "ExportService",
    "ExportFormatEnum",
    "ExportError",
    "format_timestamp",
    "format_duration",
    "convert_to_srt",
    "convert_to_markdown",
    
    # Batch processing
    "BatchProcessor",
    "BatchTaskClass",
    "BatchProgressClass",
    "TaskType",
    "create_batch_processor_old",
    "BatchProcessorProtocolOld",
    
    # Performance optimization services
    "ResourceMonitor",
    "SystemResources",
    "PerformanceMetrics",
    "M3OptimizationConfig",
    "ResourceThresholds",
    "ResourceMonitorProtocol",
    "create_resource_monitor",
    
    "PerformanceOptimizer",
    "PerformanceOptimizerProtocol",
    "create_performance_optimizer",
    
    "FFmpegOptimizer",
    "FFmpegOptimizerProtocol",
    "create_ffmpeg_optimizer",
    
    "PerformanceBenchmarker",
    "PerformanceStatistics",
    "PerformanceBenchmarkerProtocol",
    "create_performance_benchmarker",
    
    "DatabaseOptimizer",
    "DatabaseOptimizerProtocol",
    "create_database_optimizer",
    
    # Quality assessment services
    "QualityAssessor",
    "QualityMetrics",
    "QualityWarning",
    "WarningSeverity",
    "QualityAssessorProtocol",
    "create_quality_assessor",
    
    "ConfidenceScorer",
    "SegmentConfidence",
    "ConfidenceLevel",
    "ConfidenceScorerProtocol",
    "create_confidence_scorer",
    
    "TranscriptComparer",
    "SegmentChange",
    "ComparisonResult",
    "ChangeType",
    "TranscriptComparerProtocol",
    "create_transcript_comparer",
]
