"""Helper script for legacy plan removal robot tests.

Accepts a single argument indicating which scenario to run.
This avoids inline Python code with '=' characters that Robot
Framework misinterprets as keyword arguments.
"""

import sys
import warnings

warnings.simplefilter("always")

scenario = sys.argv[1] if len(sys.argv) > 1 else ""

if scenario == "plan_service":
    from unittest.mock import MagicMock

    from cleveragents.application.services.plan_service import PlanService

    PlanService(
        settings=MagicMock(
            database_url="sqlite:///:memory:",
        ),
        unit_of_work=MagicMock(),
    )

elif scenario == "plan_repository":
    from unittest.mock import MagicMock

    from cleveragents.infrastructure.database.repositories import PlanRepository

    PlanRepository(MagicMock())

elif scenario == "change_repository":
    from unittest.mock import MagicMock

    from cleveragents.infrastructure.database.repositories import ChangeRepository

    ChangeRepository(MagicMock())

elif scenario == "lifecycle_service":
    from unittest.mock import MagicMock

    from cleveragents.application.services.plan_lifecycle_service import (
        PlanLifecycleService,
    )

    PlanLifecycleService(settings=MagicMock())

else:
    print(f"Unknown scenario: {scenario}", file=sys.stderr)
    sys.exit(1)
