"""Types for the live kanban worker E2E battery."""
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Any, Literal

WorkerSeed = Literal["http", "batch", "chat"]


@dataclass
class WorkerCase:
    """One end-to-end worker scenario: seed task(s) → dispatcher → terminal outcome."""

    id: str
    seed: WorkerSeed = "http"
    pillar: str = "worker"
    title: str = ""
    body: str = ""
    assignee: str = "general"
    priority: int = 3
    metadata: dict[str, Any] = field(default_factory=dict)
    batch_items: list[dict[str, Any]] = field(default_factory=list)
    chat_prompt: str = ""
    chat_required_tools: tuple[str, ...] = ("kanban_create_task",)
    chat_timeout_sec: float = 120.0
    expect_tasks_done: int = 1
    expected_status: str = "done"
    forbidden_statuses: tuple[str, ...] = ("gave_up", "cancelled")
    expected_run_outcome: str = "completed"
    require_markers_in_summary: tuple[str, ...] = ()
    min_summary_chars: int = 48
    timeout_sec: float = 300.0
    poll_sec: float = 4.0
    notes: str = ""


@dataclass
class WorkerCaseResult:
    case_id: str
    passed: bool
    elapsed_sec: float
    pillar: str = "worker"
    tenant: str = ""
    task_ids: list[str] = field(default_factory=list)
    terminal: list[dict[str, Any]] = field(default_factory=list)
    failures: list[str] = field(default_factory=list)
    chat_thread_id: str = ""
    timed_out: bool = False
    flaky: bool = False
    attempts: int = 1
    first_attempt_failures: list[str] = field(default_factory=list)
