#!/usr/bin/env python3
"""
进度相关的数据类型定义
"""

from dataclasses import dataclass
from typing import Any, Optional

@dataclass
class ProgressInfo:
    """进度信息"""
    current: int
    total: int
    message: str = ""
    percentage: float = 0.0
    elapsed_time: float = 0.0
    estimated_remaining: float = 0.0
    
    def __post_init__(self):
        """计算百分比"""
        if self.total > 0:
            self.percentage = (self.current / self.total) * 100

@dataclass
class TaskResult:
    """任务结果"""
    success: bool
    result: Any = None
    error: str = None
    total_time: float = 0.0
    final_progress: Optional[ProgressInfo] = None
