mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 05:51:09 -05:00
97 lines
3.2 KiB
Markdown
97 lines
3.2 KiB
Markdown
# Ride System Enums Documentation
|
|
|
|
## Overview
|
|
The Rides system uses several enum classes to maintain consistent data and provide type safety for various ride attributes. All enums follow a consistent pattern with common helper methods for values, labels, and options.
|
|
|
|
## Implementation Details
|
|
|
|
### 1. RideCategory
|
|
- **Purpose**: Categorizes different types of rides
|
|
- **Location**: `app/Enums/RideCategory.php`
|
|
- **Values**:
|
|
- `SELECT` (''): Default selection prompt
|
|
- `ROLLER_COASTER` ('RC'): Roller coasters
|
|
- `DARK_RIDE` ('DR'): Dark rides
|
|
- `FLAT_RIDE` ('FR'): Flat rides
|
|
- `WATER_RIDE` ('WR'): Water rides
|
|
- `TRANSPORT` ('TR'): Transport rides
|
|
- `OTHER` ('OT'): Other ride types
|
|
|
|
### 2. RideStatus
|
|
- **Purpose**: Tracks operational status of rides
|
|
- **Location**: `app/Enums/RideStatus.php`
|
|
- **Values**:
|
|
- `SELECT` (''): Default selection prompt
|
|
- `OPERATING`: Currently operating
|
|
- `CLOSED_TEMP`: Temporarily closed
|
|
- `SBNO`: Standing but not operating
|
|
- `CLOSING`: Scheduled for closure
|
|
- `CLOSED_PERM`: Permanently closed
|
|
- `UNDER_CONSTRUCTION`: Under construction
|
|
- `DEMOLISHED`: Demolished
|
|
- `RELOCATED`: Relocated
|
|
- **Features**:
|
|
- Includes post-closing status handling
|
|
- Helper methods for filtering post-closing statuses
|
|
|
|
### 3. TrackMaterial
|
|
- **Purpose**: Specifies roller coaster track material
|
|
- **Location**: `app/Enums/TrackMaterial.php`
|
|
- **Values**:
|
|
- `STEEL`: Steel tracks
|
|
- `WOOD`: Wooden tracks
|
|
- `HYBRID`: Hybrid construction
|
|
|
|
### 4. RollerCoasterType
|
|
- **Purpose**: Defines specific roller coaster configurations
|
|
- **Location**: `app/Enums/RollerCoasterType.php`
|
|
- **Values**:
|
|
- `SITDOWN`: Traditional sit-down coaster
|
|
- `INVERTED`: Inverted coaster
|
|
- `FLYING`: Flying coaster
|
|
- `STANDUP`: Stand-up coaster
|
|
- `WING`: Wing coaster
|
|
- `DIVE`: Dive coaster
|
|
- `FAMILY`: Family coaster
|
|
- `WILD_MOUSE`: Wild Mouse style
|
|
- `SPINNING`: Spinning coaster
|
|
- `FOURTH_DIMENSION`: 4th Dimension coaster
|
|
- `OTHER`: Other configurations
|
|
|
|
### 5. LaunchType
|
|
- **Purpose**: Specifies ride launch mechanism
|
|
- **Location**: `app/Enums/LaunchType.php`
|
|
- **Values**:
|
|
- `CHAIN`: Traditional chain lift
|
|
- `LSM`: Linear Synchronous Motor launch
|
|
- `HYDRAULIC`: Hydraulic launch system
|
|
- `GRAVITY`: Gravity-powered launch
|
|
- `OTHER`: Other launch types
|
|
|
|
## Common Features
|
|
All enum classes include:
|
|
1. String-backed values for database storage
|
|
2. Human-readable labels via `label()` method
|
|
3. Helper methods:
|
|
- `values()`: Get all enum values
|
|
- `labels()`: Get all human-readable labels
|
|
- `options()`: Get value-label pairs for forms
|
|
|
|
## Usage Notes
|
|
1. All enums maintain exact parity with Django choices
|
|
2. Used in models for type validation
|
|
3. Support form select options generation
|
|
4. Enable consistent validation rules
|
|
5. Provide clean database values
|
|
|
|
## Design Decisions
|
|
1. Used PHP 8.1 enum feature for type safety
|
|
2. Maintained consistent method names across all enums
|
|
3. Added helper methods to simplify form handling
|
|
4. Included blank/select options where needed
|
|
5. Used string backing for database compatibility
|
|
|
|
## Related Files
|
|
- `app/Models/Ride.php` (uses RideCategory, RideStatus)
|
|
- `app/Models/RollerCoasterStats.php` (uses TrackMaterial, RollerCoasterType, LaunchType)
|
|
- Future Livewire components for ride forms |