"""engine_v2/engine_result.py — 엔진 실행 결과 데이터클래스."""

from __future__ import annotations

from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Literal

EngineRole = Literal["claude", "gemini", "codex"]


@dataclass
class EngineResult:
    """멀티엔진 공통 응답 컨테이너.

    Attributes:
        engine: 사용된 엔진 종류
        content: raw output (원본)
        clean: sanitized output (정제)
        task_id: 작업 식별자
        step: 파이프라인 단계 번호
        timestamp: 실행 시각 (UTC)
        token_est: 추정 토큰 수
        error: 에러 발생 여부
        fallback_used: fallback 모델 사용 여부
        flagged_count: 인젝션 탐지 횟수
    """

    engine: EngineRole
    content: str
    clean: str
    task_id: str
    step: int
    timestamp: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
    token_est: int = 0
    error: bool = False
    fallback_used: bool = False
    flagged_count: int = 0
