"""
Rich Choice Objects for Notifications Domain

This module defines all choice objects for the notifications domain,
using the RichChoices pattern for consistent UI rendering and validation.
"""

from apps.core.choices import ChoiceCategory, RichChoice
from apps.core.choices.registry import register_choices

# ============================================================================
# Notification Log Status Choices
# ============================================================================
NOTIFICATION_LOG_STATUSES = [
    RichChoice(
        value="pending",
        label="Pending",
        description="Notification is queued for delivery",
        metadata={
            "color": "yellow",
            "icon": "clock",
            "css_class": "bg-yellow-100 text-yellow-800",
            "sort_order": 1,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="sent",
        label="Sent",
        description="Notification has been sent",
        metadata={
            "color": "blue",
            "icon": "send",
            "css_class": "bg-blue-100 text-blue-800",
            "sort_order": 2,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="delivered",
        label="Delivered",
        description="Notification was successfully delivered",
        metadata={
            "color": "green",
            "icon": "check-circle",
            "css_class": "bg-green-100 text-green-800",
            "sort_order": 3,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="failed",
        label="Failed",
        description="Notification delivery failed",
        metadata={
            "color": "red",
            "icon": "x-circle",
            "css_class": "bg-red-100 text-red-800",
            "sort_order": 4,
        },
        category=ChoiceCategory.STATUS,
    ),
]

# ============================================================================
# System Announcement Severity Choices
# ============================================================================
ANNOUNCEMENT_SEVERITIES = [
    RichChoice(
        value="info",
        label="Information",
        description="Informational announcement",
        metadata={
            "color": "blue",
            "icon": "info",
            "css_class": "bg-blue-100 text-blue-800 border-blue-200",
            "sort_order": 1,
        },
        category=ChoiceCategory.PRIORITY,
    ),
    RichChoice(
        value="warning",
        label="Warning",
        description="Warning announcement requiring attention",
        metadata={
            "color": "yellow",
            "icon": "alert-triangle",
            "css_class": "bg-yellow-100 text-yellow-800 border-yellow-200",
            "sort_order": 2,
        },
        category=ChoiceCategory.PRIORITY,
    ),
    RichChoice(
        value="critical",
        label="Critical",
        description="Critical announcement requiring immediate attention",
        metadata={
            "color": "red",
            "icon": "alert-octagon",
            "css_class": "bg-red-100 text-red-800 border-red-200",
            "sort_order": 3,
        },
        category=ChoiceCategory.PRIORITY,
    ),
]

# ============================================================================
# Notification Level Choices (for in-app notifications)
# ============================================================================
NOTIFICATION_LEVELS = [
    RichChoice(
        value="info",
        label="Info",
        description="Informational notification",
        metadata={
            "color": "blue",
            "icon": "info",
            "css_class": "bg-blue-100 text-blue-800",
            "sort_order": 1,
        },
        category=ChoiceCategory.NOTIFICATION,
    ),
    RichChoice(
        value="success",
        label="Success",
        description="Success notification",
        metadata={
            "color": "green",
            "icon": "check-circle",
            "css_class": "bg-green-100 text-green-800",
            "sort_order": 2,
        },
        category=ChoiceCategory.NOTIFICATION,
    ),
    RichChoice(
        value="warning",
        label="Warning",
        description="Warning notification",
        metadata={
            "color": "yellow",
            "icon": "alert-triangle",
            "css_class": "bg-yellow-100 text-yellow-800",
            "sort_order": 3,
        },
        category=ChoiceCategory.NOTIFICATION,
    ),
    RichChoice(
        value="error",
        label="Error",
        description="Error notification",
        metadata={
            "color": "red",
            "icon": "x-circle",
            "css_class": "bg-red-100 text-red-800",
            "sort_order": 4,
        },
        category=ChoiceCategory.NOTIFICATION,
    ),
]


def register_notifications_choices() -> None:
    """Register all notifications domain choices with the global registry."""
    register_choices(
        name="notification_log_statuses",
        choices=NOTIFICATION_LOG_STATUSES,
        domain="notifications",
        description="Status options for notification logs",
    )
    register_choices(
        name="announcement_severities",
        choices=ANNOUNCEMENT_SEVERITIES,
        domain="notifications",
        description="Severity levels for system announcements",
    )
    register_choices(
        name="notification_levels",
        choices=NOTIFICATION_LEVELS,
        domain="notifications",
        description="Level options for in-app notifications",
    )


# Auto-register choices when module is imported
register_notifications_choices()
