from simorgh.apps.modules.registry import CapabilitySpec, FeatureSpec, ModuleManifest, register_module

register_module(
    ModuleManifest(
        name="workflow",
        version=1,
        domain="platform",
        label_key="workflow.module_label",
        description="Workflow Engine — state machines, transitions, and approval flows",
        capabilities=(
            CapabilitySpec(slug="fsm", label_key="workflow.capabilities.fsm",
                          description="State machines and transitions", icon="flow"),
        ),
        features=(
            FeatureSpec(code="fsm.state_machine", label_key="workflow.features.state_machine", scope="tenant", default_enabled=True, is_platform_internal=False, description="Define state machines with transitions"),
            FeatureSpec(code="fsm.approval_flows", label_key="workflow.features.approval_flows", scope="tenant", default_enabled=True, is_platform_internal=False, description="Multi-step approval workflows"),
            FeatureSpec(code="fsm.transition_actions", label_key="workflow.features.transition_actions", scope="tenant", description="Side-effect actions on state transitions"),
        ),
        permissions=(
            "workflow.instance.view",
            "workflow.instance.manage",
            "workflow.transition.fire",
            "workflow.approval.grant",
        ),
    )
)
