"""
Rich Choice Objects for Rides Domain

This module defines all choice objects for the rides domain, replacing
the legacy tuple-based choices with rich choice objects.
"""

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

# Ride Category Choices
RIDE_CATEGORIES = [
    RichChoice(
        value="RC",
        label="Roller Coaster",
        description="Thrill rides with tracks featuring hills, loops, and high speeds",
        metadata={"color": "red", "icon": "roller-coaster", "css_class": "bg-red-100 text-red-800", "sort_order": 1},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="DR",
        label="Dark Ride",
        description="Indoor rides with themed environments and storytelling",
        metadata={
            "color": "purple",
            "icon": "dark-ride",
            "css_class": "bg-purple-100 text-purple-800",
            "sort_order": 2,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="FR",
        label="Flat Ride",
        description="Rides that move along a generally flat plane with spinning, swinging, or bouncing motions",
        metadata={"color": "blue", "icon": "flat-ride", "css_class": "bg-blue-100 text-blue-800", "sort_order": 3},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="WR",
        label="Water Ride",
        description="Rides that incorporate water elements like splashing, floating, or getting wet",
        metadata={"color": "cyan", "icon": "water-ride", "css_class": "bg-cyan-100 text-cyan-800", "sort_order": 4},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="TR",
        label="Transport Ride",
        description="Rides primarily designed for transportation around the park",
        metadata={"color": "green", "icon": "transport", "css_class": "bg-green-100 text-green-800", "sort_order": 5},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="OT",
        label="Other",
        description="Rides that don't fit into standard categories",
        metadata={"color": "gray", "icon": "other", "css_class": "bg-gray-100 text-gray-800", "sort_order": 6},
        category=ChoiceCategory.CLASSIFICATION,
    ),
]

# Ride Status Choices
RIDE_STATUSES = [
    RichChoice(
        value="OPERATING",
        label="Operating",
        description="Ride is currently open and operating normally",
        metadata={
            "color": "green",
            "icon": "check-circle",
            "css_class": "bg-green-100 text-green-800",
            "sort_order": 1,
            "can_transition_to": [
                "CLOSED_TEMP",
                "SBNO",
                "CLOSING",
            ],
            "requires_moderator": False,
            "is_final": False,
            "is_initial": True,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="CLOSED_TEMP",
        label="Temporarily Closed",
        description="Ride is temporarily closed for maintenance, weather, or other short-term reasons",
        metadata={
            "color": "yellow",
            "icon": "pause-circle",
            "css_class": "bg-yellow-100 text-yellow-800",
            "sort_order": 2,
            "can_transition_to": [
                "OPERATING",  # Reopen after temporary closure
                "SBNO",
                "CLOSING",
            ],
            "requires_moderator": False,
            "is_final": False,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="SBNO",
        label="Standing But Not Operating",
        description="Ride structure remains but is not currently operating",
        metadata={
            "color": "orange",
            "icon": "stop-circle",
            "css_class": "bg-orange-100 text-orange-800",
            "sort_order": 3,
            "can_transition_to": [
                "OPERATING",  # Revival - ride returns to operation
                "CLOSED_PERM",
                "DEMOLISHED",
                "RELOCATED",
            ],
            "requires_moderator": True,
            "is_final": False,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="CLOSING",
        label="Closing",
        description="Ride is scheduled to close permanently",
        metadata={
            "color": "red",
            "icon": "x-circle",
            "css_class": "bg-red-100 text-red-800",
            "sort_order": 4,
            "can_transition_to": [
                "CLOSED_PERM",
                "SBNO",
            ],
            "requires_moderator": True,
            "is_final": False,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="CLOSED_PERM",
        label="Permanently Closed",
        description="Ride has been permanently closed and will not reopen",
        metadata={
            "color": "red",
            "icon": "x-circle",
            "css_class": "bg-red-100 text-red-800",
            "sort_order": 5,
            "can_transition_to": [
                "DEMOLISHED",
                "RELOCATED",
            ],
            "requires_moderator": True,
            "is_final": False,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="UNDER_CONSTRUCTION",
        label="Under Construction",
        description="Ride is currently being built or undergoing major renovation",
        metadata={
            "color": "blue",
            "icon": "tool",
            "css_class": "bg-blue-100 text-blue-800",
            "sort_order": 6,
            "can_transition_to": [
                "OPERATING",
            ],
            "requires_moderator": False,
            "is_final": False,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="DEMOLISHED",
        label="Demolished",
        description="Ride has been completely removed and demolished",
        metadata={
            "color": "gray",
            "icon": "trash",
            "css_class": "bg-gray-100 text-gray-800",
            "sort_order": 7,
            "can_transition_to": [],
            "requires_moderator": True,
            "is_final": True,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="RELOCATED",
        label="Relocated",
        description="Ride has been moved to a different location",
        metadata={
            "color": "purple",
            "icon": "arrow-right",
            "css_class": "bg-purple-100 text-purple-800",
            "sort_order": 8,
            "can_transition_to": [],
            "requires_moderator": True,
            "is_final": True,
        },
        category=ChoiceCategory.STATUS,
    ),
]

# Post-Closing Status Choices
POST_CLOSING_STATUSES = [
    RichChoice(
        value="SBNO",
        label="Standing But Not Operating",
        description="Ride structure remains but is not operating after closure",
        metadata={
            "color": "orange",
            "icon": "stop-circle",
            "css_class": "bg-orange-100 text-orange-800",
            "sort_order": 1,
        },
        category=ChoiceCategory.STATUS,
    ),
    RichChoice(
        value="CLOSED_PERM",
        label="Permanently Closed",
        description="Ride has been permanently closed after the closing date",
        metadata={"color": "red", "icon": "x-circle", "css_class": "bg-red-100 text-red-800", "sort_order": 2},
        category=ChoiceCategory.STATUS,
    ),
]

# Roller Coaster Track Material Choices
TRACK_MATERIALS = [
    RichChoice(
        value="STEEL",
        label="Steel",
        description="Modern steel track construction providing smooth rides and complex layouts",
        metadata={"color": "gray", "icon": "steel", "css_class": "bg-gray-100 text-gray-800", "sort_order": 1},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="WOOD",
        label="Wood",
        description="Traditional wooden track construction providing classic coaster experience",
        metadata={"color": "amber", "icon": "wood", "css_class": "bg-amber-100 text-amber-800", "sort_order": 2},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="HYBRID",
        label="Hybrid",
        description="Combination of steel and wooden construction elements",
        metadata={"color": "orange", "icon": "hybrid", "css_class": "bg-orange-100 text-orange-800", "sort_order": 3},
        category=ChoiceCategory.TECHNICAL,
    ),
]

# Roller Coaster Type Choices
COASTER_TYPES = [
    RichChoice(
        value="SITDOWN",
        label="Sit Down",
        description="Traditional seated roller coaster with riders sitting upright",
        metadata={"color": "blue", "icon": "sitdown", "css_class": "bg-blue-100 text-blue-800", "sort_order": 1},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="INVERTED",
        label="Inverted",
        description="Coaster where riders' feet dangle freely below the track",
        metadata={"color": "purple", "icon": "inverted", "css_class": "bg-purple-100 text-purple-800", "sort_order": 2},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="FLYING",
        label="Flying",
        description="Riders lie face-down in a flying position",
        metadata={"color": "sky", "icon": "flying", "css_class": "bg-sky-100 text-sky-800", "sort_order": 3},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="STANDUP",
        label="Stand Up",
        description="Riders stand upright during the ride",
        metadata={"color": "green", "icon": "standup", "css_class": "bg-green-100 text-green-800", "sort_order": 4},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="WING",
        label="Wing",
        description="Riders sit on either side of the track with nothing above or below",
        metadata={"color": "indigo", "icon": "wing", "css_class": "bg-indigo-100 text-indigo-800", "sort_order": 5},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="DIVE",
        label="Dive",
        description="Features a vertical or near-vertical drop as the main element",
        metadata={"color": "red", "icon": "dive", "css_class": "bg-red-100 text-red-800", "sort_order": 6},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="FAMILY",
        label="Family",
        description="Designed for riders of all ages with moderate thrills",
        metadata={
            "color": "emerald",
            "icon": "family",
            "css_class": "bg-emerald-100 text-emerald-800",
            "sort_order": 7,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="WILD_MOUSE",
        label="Wild Mouse",
        description="Compact coaster with sharp turns and sudden drops",
        metadata={"color": "yellow", "icon": "mouse", "css_class": "bg-yellow-100 text-yellow-800", "sort_order": 8},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="SPINNING",
        label="Spinning",
        description="Cars rotate freely during the ride",
        metadata={"color": "pink", "icon": "spinning", "css_class": "bg-pink-100 text-pink-800", "sort_order": 9},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="FOURTH_DIMENSION",
        label="4th Dimension",
        description="Seats rotate independently of the track direction",
        metadata={"color": "violet", "icon": "4d", "css_class": "bg-violet-100 text-violet-800", "sort_order": 10},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="OTHER",
        label="Other",
        description="Coaster type that doesn't fit standard classifications",
        metadata={"color": "gray", "icon": "other", "css_class": "bg-gray-100 text-gray-800", "sort_order": 11},
        category=ChoiceCategory.CLASSIFICATION,
    ),
]

# Propulsion System Choices
PROPULSION_SYSTEMS = [
    RichChoice(
        value="CHAIN",
        label="Chain Lift",
        description="Traditional chain lift system to pull trains up the lift hill",
        metadata={"color": "gray", "icon": "chain", "css_class": "bg-gray-100 text-gray-800", "sort_order": 1},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="LSM",
        label="LSM Launch",
        description="Linear Synchronous Motor launch system using magnetic propulsion",
        metadata={"color": "blue", "icon": "lightning", "css_class": "bg-blue-100 text-blue-800", "sort_order": 2},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="HYDRAULIC",
        label="Hydraulic Launch",
        description="High-pressure hydraulic launch system for rapid acceleration",
        metadata={"color": "red", "icon": "hydraulic", "css_class": "bg-red-100 text-red-800", "sort_order": 3},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="GRAVITY",
        label="Gravity",
        description="Uses gravity and momentum without mechanical lift systems",
        metadata={"color": "green", "icon": "gravity", "css_class": "bg-green-100 text-green-800", "sort_order": 4},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="OTHER",
        label="Other",
        description="Propulsion system that doesn't fit standard categories",
        metadata={"color": "gray", "icon": "other", "css_class": "bg-gray-100 text-gray-800", "sort_order": 5},
        category=ChoiceCategory.TECHNICAL,
    ),
]

# Ride Model Target Market Choices
TARGET_MARKETS = [
    RichChoice(
        value="FAMILY",
        label="Family",
        description="Designed for families with children, moderate thrills",
        metadata={"color": "green", "icon": "family", "css_class": "bg-green-100 text-green-800", "sort_order": 1},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="THRILL",
        label="Thrill",
        description="High-intensity rides for thrill seekers",
        metadata={"color": "red", "icon": "thrill", "css_class": "bg-red-100 text-red-800", "sort_order": 2},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="EXTREME",
        label="Extreme",
        description="Maximum intensity rides for extreme thrill seekers",
        metadata={"color": "purple", "icon": "extreme", "css_class": "bg-purple-100 text-purple-800", "sort_order": 3},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="KIDDIE",
        label="Kiddie",
        description="Gentle rides designed specifically for young children",
        metadata={"color": "yellow", "icon": "kiddie", "css_class": "bg-yellow-100 text-yellow-800", "sort_order": 4},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="ALL_AGES",
        label="All Ages",
        description="Suitable for riders of all ages and thrill preferences",
        metadata={"color": "blue", "icon": "all-ages", "css_class": "bg-blue-100 text-blue-800", "sort_order": 5},
        category=ChoiceCategory.CLASSIFICATION,
    ),
]

# Ride Model Photo Type Choices
PHOTO_TYPES = [
    RichChoice(
        value="PROMOTIONAL",
        label="Promotional",
        description="Marketing and promotional photos of the ride model",
        metadata={"color": "blue", "icon": "camera", "css_class": "bg-blue-100 text-blue-800", "sort_order": 1},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="TECHNICAL",
        label="Technical Drawing",
        description="Technical drawings and engineering diagrams",
        metadata={"color": "gray", "icon": "blueprint", "css_class": "bg-gray-100 text-gray-800", "sort_order": 2},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="INSTALLATION",
        label="Installation Example",
        description="Photos of actual installations of this ride model",
        metadata={
            "color": "green",
            "icon": "installation",
            "css_class": "bg-green-100 text-green-800",
            "sort_order": 3,
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="RENDERING",
        label="3D Rendering",
        description="Computer-generated 3D renderings of the ride model",
        metadata={"color": "purple", "icon": "cube", "css_class": "bg-purple-100 text-purple-800", "sort_order": 4},
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="CATALOG",
        label="Catalog Image",
        description="Official catalog and brochure images",
        metadata={"color": "orange", "icon": "catalog", "css_class": "bg-orange-100 text-orange-800", "sort_order": 5},
        category=ChoiceCategory.CLASSIFICATION,
    ),
]

# Technical Specification Category Choices
SPEC_CATEGORIES = [
    RichChoice(
        value="DIMENSIONS",
        label="Dimensions",
        description="Physical dimensions and measurements",
        metadata={"color": "blue", "icon": "ruler", "css_class": "bg-blue-100 text-blue-800", "sort_order": 1},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="PERFORMANCE",
        label="Performance",
        description="Performance specifications and capabilities",
        metadata={"color": "red", "icon": "speedometer", "css_class": "bg-red-100 text-red-800", "sort_order": 2},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="CAPACITY",
        label="Capacity",
        description="Rider capacity and throughput specifications",
        metadata={"color": "green", "icon": "users", "css_class": "bg-green-100 text-green-800", "sort_order": 3},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="SAFETY",
        label="Safety Features",
        description="Safety systems and features",
        metadata={"color": "yellow", "icon": "shield", "css_class": "bg-yellow-100 text-yellow-800", "sort_order": 4},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="ELECTRICAL",
        label="Electrical Requirements",
        description="Power and electrical system requirements",
        metadata={
            "color": "purple",
            "icon": "lightning",
            "css_class": "bg-purple-100 text-purple-800",
            "sort_order": 5,
        },
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="FOUNDATION",
        label="Foundation Requirements",
        description="Foundation and structural requirements",
        metadata={"color": "gray", "icon": "foundation", "css_class": "bg-gray-100 text-gray-800", "sort_order": 6},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="MAINTENANCE",
        label="Maintenance",
        description="Maintenance requirements and procedures",
        metadata={"color": "orange", "icon": "wrench", "css_class": "bg-orange-100 text-orange-800", "sort_order": 7},
        category=ChoiceCategory.TECHNICAL,
    ),
    RichChoice(
        value="OTHER",
        label="Other",
        description="Other technical specifications",
        metadata={"color": "gray", "icon": "other", "css_class": "bg-gray-100 text-gray-800", "sort_order": 8},
        category=ChoiceCategory.TECHNICAL,
    ),
]

# Company Role Choices for Rides Domain (MANUFACTURER and DESIGNER only)
RIDES_COMPANY_ROLES = [
    RichChoice(
        value="MANUFACTURER",
        label="Ride Manufacturer",
        description="Company that designs and builds ride hardware and systems",
        metadata={
            "color": "blue",
            "icon": "factory",
            "css_class": "bg-blue-100 text-blue-800",
            "sort_order": 1,
            "domain": "rides",
            "permissions": ["manage_ride_models", "view_manufacturing"],
            "url_pattern": "/rides/manufacturers/{slug}/",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
    RichChoice(
        value="DESIGNER",
        label="Ride Designer",
        description="Company that specializes in ride design, layout, and engineering",
        metadata={
            "color": "purple",
            "icon": "design",
            "css_class": "bg-purple-100 text-purple-800",
            "sort_order": 2,
            "domain": "rides",
            "permissions": ["manage_ride_designs", "view_design_specs"],
            "url_pattern": "/rides/designers/{slug}/",
        },
        category=ChoiceCategory.CLASSIFICATION,
    ),
]


def register_rides_choices():
    """Register all rides domain choices with the global registry"""

    register_choices(
        name="categories",
        choices=RIDE_CATEGORIES,
        domain="rides",
        description="Ride category classifications",
        metadata={"domain": "rides", "type": "category"},
    )

    register_choices(
        name="statuses",
        choices=RIDE_STATUSES,
        domain="rides",
        description="Ride operational status options",
        metadata={"domain": "rides", "type": "status"},
    )

    register_choices(
        name="post_closing_statuses",
        choices=POST_CLOSING_STATUSES,
        domain="rides",
        description="Status options after ride closure",
        metadata={"domain": "rides", "type": "post_closing_status"},
    )

    register_choices(
        name="track_materials",
        choices=TRACK_MATERIALS,
        domain="rides",
        description="Roller coaster track material types",
        metadata={"domain": "rides", "type": "track_material", "applies_to": "roller_coasters"},
    )

    register_choices(
        name="coaster_types",
        choices=COASTER_TYPES,
        domain="rides",
        description="Roller coaster type classifications",
        metadata={"domain": "rides", "type": "coaster_type", "applies_to": "roller_coasters"},
    )

    register_choices(
        name="propulsion_systems",
        choices=PROPULSION_SYSTEMS,
        domain="rides",
        description="Roller coaster propulsion and lift systems",
        metadata={"domain": "rides", "type": "propulsion_system", "applies_to": "roller_coasters"},
    )

    register_choices(
        name="target_markets",
        choices=TARGET_MARKETS,
        domain="rides",
        description="Target market classifications for ride models",
        metadata={"domain": "rides", "type": "target_market", "applies_to": "ride_models"},
    )

    register_choices(
        name="photo_types",
        choices=PHOTO_TYPES,
        domain="rides",
        description="Photo type classifications for ride model images",
        metadata={"domain": "rides", "type": "photo_type", "applies_to": "ride_model_photos"},
    )

    register_choices(
        name="spec_categories",
        choices=SPEC_CATEGORIES,
        domain="rides",
        description="Technical specification category classifications",
        metadata={"domain": "rides", "type": "spec_category", "applies_to": "ride_model_specs"},
    )

    register_choices(
        name="company_roles",
        choices=RIDES_COMPANY_ROLES,
        domain="rides",
        description="Company role classifications for rides domain (MANUFACTURER and DESIGNER only)",
        metadata={"domain": "rides", "type": "company_role"},
    )


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