// // MatchupModels.swift // FantasyWatch // // Created by Claude Code // import Foundation struct Matchup: Codable, Equatable, Sendable { let week: Int let status: String let userTeam: TeamScore let opponentTeam: TeamScore let categories: [CategoryScore] } struct TeamScore: Codable, Equatable, Sendable { let teamKey: String let teamName: String let wins: Int let losses: Int let ties: Int } struct CategoryScore: Codable, Equatable, Sendable, Identifiable { let statID: String let name: String let userValue: String let opponentValue: String var id: String { statID } enum ComparisonResult { case winning case losing case tied } var comparison: ComparisonResult { guard let userNum = Double(userValue), let opponentNum = Double(opponentValue) else { return userValue == opponentValue ? .tied : .winning } let isInvertedStat = name == "GAA" || name == "ERA" if isInvertedStat { if userNum < opponentNum { return .winning } if userNum > opponentNum { return .losing } return .tied } else { if userNum > opponentNum { return .winning } if userNum < opponentNum { return .losing } return .tied } } }