from dataclasses import dataclass
from enum import Enum
from typing import TypeVar, Protocol, Any

T = TypeVar("T")


@dataclass
class OperationInfo:
    name: str
    description: str


class OperationStatus(Enum):
    Pending = "Pending"
    InProgress = "In Progress"
    Completed = "Completed"
    Failed = "Failed"


class RunnerInteraction(Protocol):
    def on_runner_start(self): ...
    def on_runner_finish(self, statistics: 'RunnerStatistics'): ...
    def on_runner_stop(self): ...
    def on_runner_update_progress(self, progress: int): ...

    def on_op_start(self): ...
    def on_op_update(self, operation: Any): ...
    def on_op_update_status(self, operation_id: str, status: OperationStatus): ...
    def on_op_update_progress(self, operation_id: str, progress: int): ...
    def on_op_eta_update(self, operation_id: str, eta: str): ...
    def on_op_failed(self, operation_id: str, error: str): ...
    def on_op_finished(self, operation: Any): ...

    def on_task_start(self, task_name: str): ...
    def on_task_update_status(self, task_name: str, status: OperationStatus): ...
    def on_task_update_progress(self, task_name: str, progress: int): ...
    def on_task_failed(self, task_name: str, error: str): ...
    def on_task_finished(self, task_name: str): ...