- 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>
42 lines
1.4 KiB
Swift
42 lines
1.4 KiB
Swift
//
|
|
// TripPlanningEngine.swift
|
|
// SportsTime
|
|
//
|
|
// Thin orchestrator that delegates to scenario-specific planners.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Main entry point for trip planning.
|
|
/// Delegates to scenario-specific planners via the ScenarioPlanner protocol.
|
|
final class TripPlanningEngine {
|
|
|
|
/// Plans itineraries based on the request inputs.
|
|
/// Automatically detects which scenario applies and delegates to the appropriate planner.
|
|
///
|
|
/// - Parameter request: The planning request containing all inputs
|
|
/// - Returns: Ranked itineraries on success, or explicit failure with reason
|
|
func planItineraries(request: PlanningRequest) -> ItineraryResult {
|
|
|
|
// Detect scenario and get the appropriate planner
|
|
let scenario = ScenarioPlannerFactory.classify(request)
|
|
let planner = ScenarioPlannerFactory.planner(for: request)
|
|
|
|
print("[TripPlanningEngine] Detected scenario: \(scenario)")
|
|
print("[TripPlanningEngine] Using planner: \(type(of: planner))")
|
|
|
|
// Delegate to the scenario planner
|
|
let result = planner.plan(request: request)
|
|
|
|
// Log result
|
|
switch result {
|
|
case .success(let options):
|
|
print("[TripPlanningEngine] Success: \(options.count) itinerary options")
|
|
case .failure(let failure):
|
|
print("[TripPlanningEngine] Failure: \(failure.reason)")
|
|
}
|
|
|
|
return result
|
|
}
|
|
}
|