import Foundation /// Was an einem Tisch gespielt wird - wie lesen/formate.py. Nicht der Modus (Übung/). public enum SpielFormat: String, CaseIterable, Sendable, Identifiable { case cash, aof, bombpot, turnier, kpoker, vip, freeroll public var id: String { rawValue } public var name: String { switch self { case .cash: "Cash" case .aof: "All-In or Fold" case .bombpot: "Bomb Pot" case .turnier: "Turnier" case .kpoker: "K-Poker" case .vip: "VIP Arena" case .freeroll: "Freerolls" } } public var symbol: String { switch self { case .cash: "circle.circle" case .aof: "bolt.fill" case .bombpot: "flame.fill" case .turnier: "trophy.fill" case .kpoker: "keyboard" case .vip: "crown.fill" case .freeroll: "gift.fill" } } } /// Eine Zeile des Vergleichs je Format (wachstum.je_format): bb/100 mit 95-%-Spanne. public struct FormatZeile: Decodable, Equatable, Sendable, Identifiable { public var format: String public var name: String public var haende: Int public var nettoBB: Double? public var bb100: Double? public var unten: Double? public var oben: Double? public var id: String { format } enum CodingKeys: String, CodingKey { case format, name, haende, nettoBB = "netto_bb", bb100, unten, oben } public init(from d: Decoder) throws { let c = try d.container(keyedBy: CodingKeys.self) format = c.text(.format) ?? "unbekannt"; name = c.text(.name) ?? format haende = c.zahl(.haende).map { Int($0) } ?? 0; nettoBB = c.zahl(.nettoBB) bb100 = c.zahl(.bb100); unten = c.zahl(.unten); oben = c.zahl(.oben) } } /// Welches Format vorn liegt - nur wenn die Spannen es tragen (betrieb/statistik.bestes_format). public struct FormatUrteil: Decodable, Equatable, Sendable { public var format: String? public var grund: String enum CodingKeys: String, CodingKey { case format, grund } public init(from d: Decoder) throws { let c = try d.container(keyedBy: CodingKeys.self) format = c.text(.format); grund = c.text(.grund) ?? "" } }