"""Base scheduler interface for pathway execution."""

from abc import ABC, abstractmethod

from core.common import JsonObject
from core.pathways.context import Context
from core.pathways.nodes.execution import PathwayRecord
from core.pathways.pathway import Pathway


class Scheduler(ABC):
    """Base class for pathway execution schedulers.

    Each scheduler implements a different execution strategy:
    - DAG: Parallel execution of directed acyclic graphs
    - Streaming: Event-driven execution with streaming nodes
    - Stateful: Multi-turn execution with persistent state
    """

    def __init__(self, ctx: Context, max_parallel: int = 10) -> None:
        """Initialize scheduler.

        Args:
            ctx: Execution context
            max_parallel: Maximum concurrent node executions
        """
        self.ctx = ctx
        self.max_parallel = max_parallel

    @abstractmethod
    async def execute(
        self,
        pathway: Pathway,
        inputs: JsonObject,
        execution_id: str,
    ) -> PathwayRecord:
        """Execute a pathway using this scheduler's strategy.

        Args:
            pathway: The pathway to execute
            inputs: Input data (typed JSON)
            execution_id: Unique execution identifier

        Returns
        -------
            PathwayRecord with execution results
        """
