"""Fail-closed shim for a generated, uncommissioned xArm program.

The former module embedded raw Cartesian poses and cleared controller faults,
enabled motors, and moved the arm directly. It is intentionally not possible
to re-enable that behavior with an environment variable. Commissioned motion
is owned by :class:`main.integrations.workcell.WorkcellServices`.
"""

from __future__ import annotations

LEGACY_XARM_PETRI_DISABLED_MESSAGE = (
    "Generated legacy xArm Petri motion is retired: use the commissioned "
    "WorkcellServices motion controller"
)


class LegacyXArmPetriMotionDisabledError(RuntimeError):
    """Raised before the generated motion program can touch an xArm."""


def _disabled(*_args, **_kwargs):
    raise LegacyXArmPetriMotionDisabledError(LEGACY_XARM_PETRI_DISABLED_MESSAGE)


class RobotMain:
    """Compatibility name for the retired generated program."""

    def __init__(self, robot, **kwargs):
        _disabled(robot, **kwargs)

    @staticmethod
    def pprint(*args, **kwargs):
        """Retain the historical logging helper without hardware access."""

        print(*args, **kwargs)

    def run(self) -> None:
        _disabled()


def main() -> None:
    """Reject direct execution without importing or connecting to the SDK."""

    _disabled()


if __name__ == "__main__":  # pragma: no cover - exercised by launchers
    main()
