"""
{{ display_name }} - Main automation module.

This module defines the data pipeline automation that processes
data through multiple stages: fetch, transform, and analyze.
"""

from torivers_sdk import Automation, AutomationMetadata
from torivers_sdk.automation import END, START, StateGraph

from nodes import analyze, fetch, transform
from state import {{ class_name }}State


class {{ class_name }}(Automation[{{ class_name }}State]):
    """{{ display_name }} data pipeline automation."""

    def metadata(self) -> AutomationMetadata:
        """Load automation metadata from YAML manifest."""
        return AutomationMetadata.from_yaml("automation.yaml")

    def get_state_class(self) -> type[{{ class_name }}State]:
        """Return the state class for this automation."""
        return {{ class_name }}State

    def build_graph(self) -> StateGraph:
        """Build the data pipeline workflow.

        Pipeline stages:
        1. fetch - Download data from source
        2. transform - Clean and transform data
        3. analyze - Compute statistics and generate output
        """
        graph = StateGraph({{ class_name }}State)

        # Add pipeline stages
        graph.add_node("fetch", fetch)
        graph.add_node("transform", transform)
        graph.add_node("analyze", analyze)

        # Define pipeline flow
        graph.add_edge(START, "fetch")
        graph.add_edge("fetch", "transform")
        graph.add_edge("transform", "analyze")
        graph.add_edge("analyze", END)

        return graph


# Export the automation class for discovery
automation = {{ class_name }}
