from __future__ import annotations

from grantflow.core.strategies.factory import DonorFactory


def _is_placeholder(value: str) -> bool:
    lowered = str(value or "").strip().lower()
    return lowered in {"", "tbd", "to be determined", "placeholder", "n/a", "na", "unknown", "-", "--"}


def _base_state(*, llm_mode: bool) -> dict:
    strategy = DonorFactory.get_strategy("usaid")
    return {
        "donor": "usaid",
        "donor_id": "usaid",
        "strategy": strategy,
        "donor_strategy": strategy,
        "input": {"project": "Water Sanitation", "country": "Kenya"},
        "input_context": {"project": "Water Sanitation", "country": "Kenya"},
        "toc_draft": {"toc": {"project_goal": "Improve water and sanitation outcomes"}},
        "llm_mode": llm_mode,
        "iteration": 1,
        "iteration_count": 1,
        "critic_notes": {},
        "errors": [],
    }
