"""ResearchCrew — two-agent researcher + reporter pipeline.

Generated by ``cognithor init --template research``. Customize the agents,
tasks, and tools to fit your use case.
"""

from __future__ import annotations

from cognithor.crew import Crew, CrewAgent, CrewProcess, CrewTask
from cognithor.crew.decorators import agent, crew, task


class ResearchCrew:
    """Sequential research + reporting pipeline.

    - ``researcher`` collects facts on ``{topic}``.
    - ``reporter`` writes a structured markdown report from the research.
    """

    @agent
    def researcher(self) -> CrewAgent:
        return CrewAgent(
            role="Researcher",
            goal="Recherchiere das Thema '{topic}' und sammle Fakten",
            backstory=(
                "Erfahrener Research-Spezialist mit Fokus auf "
                "verlaessliche Quellen."
            ),
            llm="ollama/qwen3:8b",
            memory=True,
        )

    @agent
    def reporter(self) -> CrewAgent:
        return CrewAgent(
            role="Reporter",
            goal="Schreibe einen strukturierten Report",
            backstory=(
                "Spezialist fuer kompakte, gut lesbare Zusammenfassungen."
            ),
            llm="ollama/qwen3:8b",
        )

    @task
    def research(self) -> CrewTask:
        return CrewTask(
            description="Recherchiere: {topic}",
            expected_output="Bulletpoint-Liste der 5 wichtigsten Fakten.",
            agent=self.researcher(),
        )

    @task
    def report(self) -> CrewTask:
        return CrewTask(
            description="Schreibe basierend auf der Research einen Report.",
            expected_output="Markdown-Report, 300-500 Woerter.",
            agent=self.reporter(),
            context=[self.research()],
        )

    @crew
    def assemble(self) -> Crew:
        return Crew(
            agents=[self.researcher(), self.reporter()],
            tasks=[self.research(), self.report()],
            process=CrewProcess.SEQUENTIAL,
            verbose=False,
        )
