#!/usr/bin/env python3
"""
场景检测相关的数据类型定义
"""

from dataclasses import dataclass
from typing import List, Optional
from enum import Enum

class DetectorType(Enum):
    """检测器类型"""
    CONTENT = "content"
    THRESHOLD = "threshold"
    ADAPTIVE = "adaptive"

@dataclass
class SceneInfo:
    """场景信息"""
    index: int
    start_time: float
    end_time: float
    duration: float
    confidence: float = 0.0
    frame_count: int = 0
    thumbnail_path: Optional[str] = None

@dataclass
class VideoSceneResult:
    """单个视频的场景检测结果"""
    video_path: str
    filename: str
    success: bool
    total_scenes: int
    total_duration: float
    scenes: List[SceneInfo]
    detection_time: float
    detector_type: str
    threshold: float
    error: Optional[str] = None

@dataclass
class BatchDetectionConfig:
    """批量检测配置"""
    detector_type: DetectorType = DetectorType.CONTENT
    threshold: float = 30.0
    min_scene_length: float = 1.0
    adaptive_threshold: bool = False
    generate_thumbnails: bool = False
    output_format: str = "json"  # json, csv, txt
    save_scenes: bool = False

@dataclass
class BatchDetectionResult:
    """批量检测结果"""
    total_files: int
    processed_files: int
    failed_files: int
    total_scenes: int
    total_duration: float
    average_scenes_per_video: float
    detection_time: float
    results: List[VideoSceneResult]
    failed_list: List[dict]
    config: BatchDetectionConfig

@dataclass
class DetectionStats:
    """检测统计信息"""
    total_videos: int
    total_scenes: int
    total_duration: float
    average_duration_per_scene: float
    shortest_scene: float
    longest_scene: float
    most_scenes_video: str
    least_scenes_video: str
