// // Caption.swift // Yattee // // Model representing a video caption/subtitle track. // import Foundation /// Represents a caption/subtitle track for a video. struct Caption: Identifiable, Codable, Hashable, Sendable { /// The display label (e.g., "English", "English (auto-generated)") let label: String /// The language code (e.g., "en", "de-DE", "es-419") let languageCode: String /// The URL to fetch the caption content let url: URL /// Whether this is an auto-generated caption var isAutoGenerated: Bool { label.contains("auto-generated") } /// The base language code without region (e.g., "en" from "en-US") var baseLanguageCode: String { if let hyphenIndex = languageCode.firstIndex(of: "-") { return String(languageCode[..