tv-anarchy/Sources/TVAnarchyiOS/BridgeModels.swift

33 lines
927 B
Swift
Raw Normal View History

// Wire models for the plum-control-bridge HTTP API. These mirror the JSON the
// bridge emits (src/http.ts in plum-control-mcp) one-for-one. The iOS app is a
// pure bridge client it never touches the filesystem or SSH so these are the
// only "library" types it knows.
import Foundation
struct BridgeShow: Codable, Identifiable, Hashable {
let id: String
let name: String
let episodeCount: Int
let seasons: [Int]
let episodes: [BridgeEpisode]
}
struct BridgeEpisode: Codable, Identifiable, Hashable {
/// Opaque, server-issued stream id (base64url of the file path on black/plum).
let id: String
let season: Int
let episode: Int
let label: String
let ext: String
/// e.g. "S01E02" compact badge for the list row.
var code: String {
String(format: "S%02dE%02d", season, episode)
}
}
struct ShowsResponse: Codable {
let shows: [BridgeShow]
}