Expand station and status models

Added richer station metadata and status handling to match the Amtrak API payload. This commit introduces new station fields for name, timezone, schedule/actual timings, platform, and status, along with extra train row properties for origin and arrival/departure details used by the UI.
This commit is contained in:
Tony Bark 2026-08-23 18:19:55 -04:00
parent 6f8cca9dc9
commit ebff2c9c32

View file

@ -4,9 +4,27 @@ struct TrainAlert: Codable {
var message: String
}
struct Station: Codable {
struct Station: Codable, Sendable {
var name: String
var code: String
var platform: String?
var tz: String
var bus: Bool
var schArr: String
var schDep: String
var arr: String
var dep: String
var arrCmnt: String
var depCmnt: String
var status: StationStatus
var stopIconColor: String
var platform: String
}
enum StationStatus: String, Codable, Sendable {
case enroute = "Enroute"
case station = "Station"
case departed = "Departed"
case unknown = "Unknown"
}
struct Train: Codable {
@ -65,6 +83,12 @@ struct StaleData: Codable {
typealias TrainResponse = [String: [Train]]
typealias StationResponse = [String: StationMeta]
struct AmtrakDateFormatting {
let isoFormatter = ISO8601DateFormatter()
}
struct TrainStatusRow: Identifiable {
var id: String {
trainID
@ -72,8 +96,12 @@ struct TrainStatusRow: Identifiable {
var trainID: String
var trainNum: String
var originating: String
var routeName: String
var origin: String
var destination: String
var platform: String
var arrival: String
var departure: String
var origin: String
var syatus: String
var destination: String
}