from dataclasses import dataclass

@dataclass(frozen=True)
class SystemProfile:
    agents: int
    orchestration: str       # workflow / dynamic / hybrid
    trigger: str             # sync / async / event / scheduled
    deployment: str          # single_process / distributed
    durable_state: bool
    idempotent_effects: bool

    def labels(self):
        return (
            "multi-agent" if self.agents > 1 else "single-agent",
            self.orchestration,
            self.trigger,
            self.deployment,
        )

    def risks(self):
        issues = []
        if self.trigger in {"async", "event", "scheduled"} and not self.durable_state:
            issues.append("Long-lived/decoupled execution may lose state after restart")
        if self.trigger in {"event", "scheduled"} and not self.idempotent_effects:
            issues.append("Duplicate triggers may repeat external side effects")
        if self.deployment == "distributed" and not self.durable_state:
            issues.append("Distributed workers need recoverable shared execution state")
        return issues

profiles = [
    SystemProfile(1, "dynamic", "sync", "single_process", False, True),
    SystemProfile(4, "hybrid", "event", "distributed", True, True),
    SystemProfile(4, "hybrid", "event", "distributed", False, False),
]
for p in profiles:
    print(p.labels(), "risks=", p.risks())

assert profiles[0].labels() == ("single-agent", "dynamic", "sync", "single_process")
assert profiles[1].labels() == ("multi-agent", "hybrid", "event", "distributed")
assert profiles[1].risks() == []
assert len(profiles[2].risks()) == 3
print("3 classification checks passed")
