from simorgh.apps.modules.registry import CapabilitySpec, FeatureSpec, ModuleManifest, register_module

register_module(
    ModuleManifest(
        name="automation",
        version=1,
        domain="platform",
        label_key="automation.module_label",
        description="Automation Engine — no-code rules, webhooks, and action templates",
        capabilities=(
            CapabilitySpec(slug="rules", label_key="automation.capabilities.rules",
                          description="Automation rules and webhooks", icon="cog"),
            CapabilitySpec(slug="templates", label_key="automation.capabilities.templates",
                          description="Action templates and recipes", icon="template"),
        ),
        features=(
            FeatureSpec(code="rules.rule_engine", label_key="automation.features.rule_engine", scope="tenant", default_enabled=True, is_platform_internal=False, description="Create and execute if-this-then-that automation rules"),
            FeatureSpec(code="rules.webhooks", label_key="automation.features.webhooks", scope="tenant", default_enabled=True, is_platform_internal=False, description="Incoming and outgoing webhook endpoints"),
            FeatureSpec(code="templates.action_templates", label_key="automation.features.action_templates", scope="tenant", description="Pre-built automation templates and recipes"),
        ),
        permissions=(
            "automation.rules.view",
            "automation.rules.create",
            "automation.rules.update",
            "automation.rules.delete",
            "automation.rules.execute",
            "automation.webhooks.view",
            "automation.webhooks.create",
            "automation.webhooks.update",
            "automation.webhooks.delete",
            "automation.templates.view",
        ),
    )
)
