from simorgh.apps.modules.registry import (
    CapabilitySpec,
    FeatureSpec,
    ModuleManifest,
    register_module,
)

register_module(
    ModuleManifest(
        name="calendar",
        version=1,
        domain="business",
        label_key="calendar.module_label",
        description="Calendar — event management with attendees and cross-entity linking",
        permissions=(
            "calendar.event.view",
            "calendar.event.create",
            "calendar.event.update",
            "calendar.event.delete",
            "calendar.event.manage_others",
        ),
        events=(
            "calendar.event.created",
            "calendar.event.updated",
            "calendar.event.deleted",
        ),
        capabilities=(
            CapabilitySpec(slug="events", label_key="calendar.capabilities.events",
                          description="Event management and scheduling", icon="calendar"),
        ),
        features=(
            FeatureSpec(
                code="events.event_management",
                label_key="calendar.features.event_management",
                scope="tenant",
                default_enabled=True,
                description="Create and manage calendar events",
            ),
            FeatureSpec(
                code="events.team_calendar",
                label_key="calendar.features.team_calendar",
                scope="tenant",
                default_enabled=False,
                description="View and manage team members' calendars",
            ),
            FeatureSpec(
                code="events.event_linking",
                label_key="calendar.features.event_linking",
                scope="tenant",
                default_enabled=True,
                description="Link events to CRM, Projects, Tasks entities",
            ),
            FeatureSpec(
                code="events.attendee_management",
                label_key="calendar.features.attendee_management",
                scope="tenant",
                default_enabled=True,
                description="Invite attendees with accept/decline status",
            ),
        ),
    )
)
