"""
Rich Choice Objects for Support Domain

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

Note: Values are kept lowercase for backward compatibility with existing data.
"""

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

# ============================================================================
# Ticket Status Choices
# ============================================================================

TICKET_STATUSES = [
    RichChoice(
        value="open",
        label="Open",
        description="Ticket is awaiting response",
        metadata={
            "color": "yellow",
            "icon": "inbox",
            "css_class": "bg-yellow-100 text-yellow-800 border-yellow-200",
            "sort_order": 1,
            "can_transition_to": ["in_progress", "closed"],
            "is_actionable": True,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="in_progress",
        label="In Progress",
        description="Ticket is being worked on",
        metadata={
            "color": "blue",
            "icon": "clock",
            "css_class": "bg-blue-100 text-blue-800 border-blue-200",
            "sort_order": 2,
            "can_transition_to": ["closed"],
            "is_actionable": True,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="closed",
        label="Closed",
        description="Ticket has been resolved",
        metadata={
            "color": "green",
            "icon": "check-circle",
            "css_class": "bg-green-100 text-green-800 border-green-200",
            "sort_order": 3,
            "can_transition_to": ["open"],
            "is_actionable": False,
            "is_final": True,
        },
        category=ChoiceCategory.STATUS,
    ),
]

# ============================================================================
# Ticket Category Choices
# ============================================================================

TICKET_CATEGORIES = [
    RichChoice(
        value="general",
        label="General Inquiry",
        description="General questions or feedback",
        metadata={
            "color": "gray",
            "icon": "chat-bubble-left",
            "css_class": "bg-gray-100 text-gray-800 border-gray-200",
            "sort_order": 1,
            "default_priority": "low",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="bug",
        label="Bug Report",
        description="Report a bug or issue with the platform",
        metadata={
            "color": "red",
            "icon": "bug-ant",
            "css_class": "bg-red-100 text-red-800 border-red-200",
            "sort_order": 2,
            "default_priority": "high",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="partnership",
        label="Partnership",
        description="Partnership or collaboration inquiries",
        metadata={
            "color": "purple",
            "icon": "handshake",
            "css_class": "bg-purple-100 text-purple-800 border-purple-200",
            "sort_order": 3,
            "default_priority": "medium",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="press",
        label="Press/Media",
        description="Press inquiries and media requests",
        metadata={
            "color": "indigo",
            "icon": "newspaper",
            "css_class": "bg-indigo-100 text-indigo-800 border-indigo-200",
            "sort_order": 4,
            "default_priority": "medium",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="data",
        label="Data Correction",
        description="Request corrections to park or ride data",
        metadata={
            "color": "orange",
            "icon": "pencil-square",
            "css_class": "bg-orange-100 text-orange-800 border-orange-200",
            "sort_order": 5,
            "default_priority": "medium",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="account",
        label="Account Issue",
        description="Account-related problems or requests",
        metadata={
            "color": "cyan",
            "icon": "user-circle",
            "css_class": "bg-cyan-100 text-cyan-800 border-cyan-200",
            "sort_order": 6,
            "default_priority": "high",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
]

# ============================================================================
# Report Type Choices (for user-submitted reports about content issues)
# ============================================================================
REPORT_TYPES = [
    RichChoice(
        value="inaccurate",
        label="Inaccurate Information",
        description="Information is factually incorrect",
        metadata={
            "color": "orange",
            "icon": "alert-circle",
            "css_class": "bg-orange-100 text-orange-800 border-orange-200",
            "sort_order": 1,
            "requires_evidence": True,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="inappropriate",
        label="Inappropriate Content",
        description="Content is offensive or inappropriate",
        metadata={
            "color": "red",
            "icon": "flag",
            "css_class": "bg-red-100 text-red-800 border-red-200",
            "sort_order": 2,
            "requires_evidence": False,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="spam",
        label="Spam",
        description="Content is spam or promotional",
        metadata={
            "color": "purple",
            "icon": "mail-x",
            "css_class": "bg-purple-100 text-purple-800 border-purple-200",
            "sort_order": 3,
            "requires_evidence": False,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="copyright",
        label="Copyright Violation",
        description="Content violates copyright",
        metadata={
            "color": "indigo",
            "icon": "shield-alert",
            "css_class": "bg-indigo-100 text-indigo-800 border-indigo-200",
            "sort_order": 4,
            "requires_evidence": True,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="duplicate",
        label="Duplicate Content",
        description="Content duplicates existing entry",
        metadata={
            "color": "yellow",
            "icon": "copy",
            "css_class": "bg-yellow-100 text-yellow-800 border-yellow-200",
            "sort_order": 5,
            "requires_evidence": True,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="other",
        label="Other",
        description="Other issue not covered above",
        metadata={
            "color": "gray",
            "icon": "help-circle",
            "css_class": "bg-gray-100 text-gray-800 border-gray-200",
            "sort_order": 6,
            "requires_evidence": False,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
]

# ============================================================================
# Report Status Choices
# ============================================================================
REPORT_STATUSES = [
    RichChoice(
        value="pending",
        label="Pending",
        description="Report is awaiting review",
        metadata={
            "color": "yellow",
            "icon": "clock",
            "css_class": "bg-yellow-100 text-yellow-800 border-yellow-200",
            "sort_order": 1,
            "is_active": True,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="investigating",
        label="Investigating",
        description="Report is being investigated",
        metadata={
            "color": "blue",
            "icon": "search",
            "css_class": "bg-blue-100 text-blue-800 border-blue-200",
            "sort_order": 2,
            "is_active": True,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="resolved",
        label="Resolved",
        description="Report has been resolved with action taken",
        metadata={
            "color": "green",
            "icon": "check-circle",
            "css_class": "bg-green-100 text-green-800 border-green-200",
            "sort_order": 3,
            "is_active": False,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="dismissed",
        label="Dismissed",
        description="Report was dismissed as invalid or duplicate",
        metadata={
            "color": "gray",
            "icon": "x-circle",
            "css_class": "bg-gray-100 text-gray-800 border-gray-200",
            "sort_order": 4,
            "is_active": False,
        },
        category=ChoiceCategory.STATUS,
    ),
]


# ============================================================================
# Email Direction Choices
# ============================================================================
EMAIL_DIRECTIONS = [
    RichChoice(
        value="inbound",
        label="Inbound",
        description="Email received from user",
        metadata={
            "color": "blue",
            "icon": "arrow-down-left",
            "css_class": "bg-blue-100 text-blue-800 border-blue-200",
            "sort_order": 1,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="outbound",
        label="Outbound",
        description="Email sent to user",
        metadata={
            "color": "green",
            "icon": "arrow-up-right",
            "css_class": "bg-green-100 text-green-800 border-green-200",
            "sort_order": 2,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
]


def register_support_choices() -> None:
    """Register all support domain choices with the global registry."""
    register_choices(
        "ticket_statuses",
        TICKET_STATUSES,
        domain="support",
        description="Status options for support tickets",
    )
    register_choices(
        "ticket_categories",
        TICKET_CATEGORIES,
        domain="support",
        description="Category options for support tickets",
    )
    register_choices(
        "report_types",
        REPORT_TYPES,
        domain="support",
        description="Type options for user-submitted reports",
    )
    register_choices(
        "report_statuses",
        REPORT_STATUSES,
        domain="support",
        description="Status options for user-submitted reports",
    )
    register_choices(
        "email_directions",
        EMAIL_DIRECTIONS,
        domain="support",
        description="Direction options for email threads",
    )


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

