# Rides Management System

## Overview
The Rides Management System is a core feature that tracks and manages all rides within theme parks. This includes detailed information about individual rides, ride models, and specialized statistics for roller coasters.

## Models Structure

### RideModel
- Represents specific ride types/models that can be manufactured
- Belongs to a manufacturer
- Contains basic information like name, description, and category
- Used as a template for actual ride installations

### Ride
- Represents individual ride installations at parks
- Contains detailed operational information:
  - Basic details (name, description, category)
  - Location (park and park area)
  - Manufacturer and designer details
  - Operational status and dates
  - Physical characteristics
  - Performance metrics
- Maintains history tracking
- Supports photo attachments
- Connects to the review system
- Uses slug-based URLs

### RollerCoasterStats
- Extension for roller coaster specific details
- Tracks technical specifications:
  - Physical dimensions (height, length, speed)
  - Track characteristics
  - Train configuration
  - Operating specifications

## Database Schema

### ride_models table
```sql
CREATE TABLE ride_models (
    id bigint PRIMARY KEY,
    name varchar(255) NOT NULL,
    manufacturer_id bigint NULL,
    description text DEFAULT '',
    category varchar(2) DEFAULT '',
    created_at timestamp NOT NULL,
    updated_at timestamp NOT NULL
);
```

### rides table
```sql
CREATE TABLE rides (
    id bigint PRIMARY KEY,
    name varchar(255) NOT NULL,
    slug varchar(255) NOT NULL,
    description text DEFAULT '',
    park_id bigint NOT NULL,
    park_area_id bigint NULL,
    category varchar(2) DEFAULT '',
    manufacturer_id bigint NULL,
    designer_id bigint NULL,
    ride_model_id bigint NULL,
    status varchar(20) DEFAULT 'OPERATING',
    post_closing_status varchar(20) NULL,
    opening_date date NULL,
    closing_date date NULL,
    status_since date NULL,
    min_height_in integer NULL,
    max_height_in integer NULL,
    capacity_per_hour integer NULL,
    ride_duration_seconds integer NULL,
    average_rating decimal(3,2) NULL,
    created_at timestamp NOT NULL,
    updated_at timestamp NOT NULL,
    UNIQUE(park_id, slug)
);
```

### roller_coaster_stats table
```sql
CREATE TABLE roller_coaster_stats (
    id bigint PRIMARY KEY,
    ride_id bigint NOT NULL UNIQUE,
    height_ft decimal(6,2) NULL,
    length_ft decimal(7,2) NULL,
    speed_mph decimal(5,2) NULL,
    inversions integer DEFAULT 0,
    ride_time_seconds integer NULL,
    track_type varchar(255) DEFAULT '',
    track_material varchar(20) DEFAULT 'STEEL',
    roller_coaster_type varchar(20) DEFAULT 'SITDOWN',
    max_drop_height_ft decimal(6,2) NULL,
    launch_type varchar(20) DEFAULT 'CHAIN',
    train_style varchar(255) DEFAULT '',
    trains_count integer NULL,
    cars_per_train integer NULL,
    seats_per_car integer NULL
);
```

## Constants

### Ride Categories
- RC: Roller Coaster
- DR: Dark Ride
- FR: Flat Ride
- WR: Water Ride
- TR: Transport
- OT: Other

### Ride Statuses
- OPERATING: Operating
- CLOSED_TEMP: Temporarily Closed
- SBNO: Standing But Not Operating
- CLOSING: Closing
- CLOSED_PERM: Permanently Closed
- UNDER_CONSTRUCTION: Under Construction
- DEMOLISHED: Demolished
- RELOCATED: Relocated

### Track Materials
- STEEL: Steel
- WOOD: Wood
- HYBRID: Hybrid

### Roller Coaster Types
- SITDOWN: Sit Down
- INVERTED: Inverted
- FLYING: Flying
- STANDUP: Stand Up
- WING: Wing
- DIVE: Dive
- FAMILY: Family
- WILD_MOUSE: Wild Mouse
- SPINNING: Spinning
- FOURTH_DIMENSION: 4th Dimension
- OTHER: Other

### Launch Types
- CHAIN: Chain Lift
- LSM: LSM Launch
- HYDRAULIC: Hydraulic Launch
- GRAVITY: Gravity
- OTHER: Other

## Implementation Notes

### History Tracking
- Both Ride and RideModel use pghistory for tracking changes
- Changes are tracked in corresponding event tables
- Event models include display change methods for UI

### Relationships
- Rides belong to Parks and optionally to ParkAreas
- Rides can have a RideModel
- Rides can have a Manufacturer and Designer
- RideModels belong to Manufacturers
- Rides have polymorphic relationships with Photos and Reviews

### Laravel Implementation Plan
1. Create migrations for all tables
2. Create Enum classes for constants
3. Implement Models with relationships
4. Add history tracking support
5. Create Livewire components for CRUD operations
6. Implement views and forms
7. Add validation rules
8. Create factories and seeders for testing