"""ServiceContainer — boot-time services, frozen after creation.

Created once at bootstrap and shared across all executions.
Uses concrete types directly — protocols only where real extensibility exists.
"""

from pydantic import BaseModel

from core.protocols.services import (
    PathwayVMLike,
    StateStoreLike,
)


class ServiceContainer(BaseModel):
    """Immutable bag of boot-time services injected into every Context.

    Frozen after creation — services are set once and never mutated.
    Nodes access them via ``ctx.services.<name>``.
    """

    model_config = {"arbitrary_types_allowed": True, "frozen": True}

    # Kept deliberately untyped (object) to avoid import cycles:
    # PathwayService -> PathwayEditor -> validation -> Context -> ServiceContainer
    pathway_service: object | None = None
    pathway_executor: PathwayVMLike | None = None
    state_store: StateStoreLike | None = None

    # Agent repository — set by consumer repos that need agent.turn / agent.list
    agent_repo: object | None = None


__all__ = ["ServiceContainer"]
