"""Entry point for the {{ project_name }} crew.

Run via::

    {{ project_name }}                    # via project.scripts
    python -m {{ project_name }}.main     # module form

Or embed in Python code::

    from {{ project_name }}.crew import VersicherungsCrew

    result = VersicherungsCrew().assemble().kickoff(
        inputs={"topic": "PKV", "customer_info": "Freelancer, 35"}
    )
    print(result.raw)
"""

from __future__ import annotations

import asyncio
import sys

from {{ project_name }}.crew import VersicherungsCrew


def main() -> int:
    """CLI entry — accept ``topic`` as the first arg or prompt for it."""
    if len(sys.argv) > 1:
        topic = " ".join(sys.argv[1:])
    else:
        topic = input("Topic (Versicherungsart): ").strip()
    if not topic:
        print("error: no topic given", file=sys.stderr)
        return 2

    customer_info = input("Kundenprofil (optional): ").strip() or "nicht angegeben"

    # Real deployment should pass the Planner's ollama client so the
    # StringGuardrail can reach a validator model. For the CLI entry, we
    # defer to Cognithor's default planner wiring via the crew runtime.
    crew = VersicherungsCrew().assemble()
    result = asyncio.run(
        crew.kickoff_async(inputs={"topic": topic, "customer_info": customer_info})
    )
    print(result.raw)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
