"""LangGraph 상태 정의."""
from __future__ import annotations

from typing import Any, Optional, TypedDict


class ExtractState(TypedDict, total=False):
    image_b64: str          # base64 이미지 (그래프 내부에서 디코드)
    mime: str
    raw_output: str         # LLM 원문
    ir: dict[str, Any]      # 파싱/검증된 IR dict
    errors: list[str]       # 검증 오류
    attempts: int           # 재시도 횟수
    confidence: float


class GenerateState(TypedDict, total=False):
    product: dict[str, Any]
    values: dict[str, Any]      # resolved 컨텍스트
    reference_tone: str
    raw_output: str
    generated: dict[str, Any]   # review_bullets / outlook
    warnings: list[str]
