//
//  Region.swift
//  SportsTime
//
//  Geographic regions for trip classification.
//

import Foundation

enum Region: String, CaseIterable, Identifiable, Codable, Hashable {
    case east = "East Coast"
    case central = "Central"
    case west = "West Coast"
    case crossCountry = "Cross-Country"

    var id: String { rawValue }

    var displayName: String { rawValue }

    var shortName: String {
        switch self {
        case .east: return "East"
        case .central: return "Central"
        case .west: return "West"
        case .crossCountry: return "Coast to Coast"
        }
    }

    var iconName: String {
        switch self {
        case .east: return "building.2"
        case .central: return "building"
        case .west: return "sun.max"
        case .crossCountry: return "arrow.left.arrow.right"
        }
    }

    /// Classifies a stadium's region based on longitude.
    ///
    /// Longitude boundaries:
    /// - East: > -85 (NYC, Boston, Miami, Toronto, Montreal, Atlanta)
    /// - Central: -110 to -85 (Chicago, Houston, Dallas, Minneapolis, Denver)
    /// - West: < -110 (LA, SF, Seattle, Phoenix, Las Vegas)
    static func classify(longitude: Double) -> Region {
        switch longitude {
        case _ where longitude > -85:
            return .east
        case -110...(-85):
            return .central
        default:
            return .west
        }
    }
}
