- Three-scenario planning engine (A: date range, B: selected games, C: directional routes) - GeographicRouteExplorer with anchor game support for route exploration - Shared ItineraryBuilder for travel segment calculation - TravelEstimator for driving time/distance estimation - SwiftUI views for trip creation and detail display - CloudKit integration for schedule data - Python scraping scripts for sports schedules 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Swift
50 lines
1.5 KiB
Swift
//
|
|
// ScenarioPlanner.swift
|
|
// SportsTime
|
|
//
|
|
// Protocol for scenario-based trip planning.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Protocol that all scenario planners must implement.
|
|
/// Each scenario (A, B, C) has its own isolated implementation.
|
|
protocol ScenarioPlanner {
|
|
|
|
/// Plan itineraries for this scenario.
|
|
/// - Parameter request: The planning request with all inputs
|
|
/// - Returns: Success with ranked itineraries, or explicit failure
|
|
func plan(request: PlanningRequest) -> ItineraryResult
|
|
}
|
|
|
|
/// Factory for creating the appropriate scenario planner
|
|
enum ScenarioPlannerFactory {
|
|
|
|
/// Creates the appropriate planner based on the request inputs
|
|
static func planner(for request: PlanningRequest) -> ScenarioPlanner {
|
|
// Scenario B: User selected specific games
|
|
if !request.selectedGames.isEmpty {
|
|
return ScenarioBPlanner()
|
|
}
|
|
|
|
// Scenario C: User specified start and end locations
|
|
if request.startLocation != nil && request.endLocation != nil {
|
|
return ScenarioCPlanner()
|
|
}
|
|
|
|
// Scenario A: Date range only (default)
|
|
return ScenarioAPlanner()
|
|
}
|
|
|
|
/// Classifies which scenario applies to this request
|
|
static func classify(_ request: PlanningRequest) -> PlanningScenario {
|
|
if !request.selectedGames.isEmpty {
|
|
return .scenarioB
|
|
}
|
|
if request.startLocation != nil && request.endLocation != nil {
|
|
return .scenarioC
|
|
}
|
|
return .scenarioA
|
|
}
|
|
}
|