23 lines
590 B
Swift
23 lines
590 B
Swift
import Foundation
|
|
|
|
struct ContentItem: Identifiable, Hashable, Codable {
|
|
let id: String // slug 作为 ID
|
|
let title: String
|
|
let year: Int
|
|
let category: ContentCategory
|
|
let rating: Double?
|
|
let posterURL: URL?
|
|
let badges: [String] // 新片/已完结/热门/推荐
|
|
let onlineCount: Int
|
|
let netdiskCount: Int
|
|
let detailURL: String // 相对路径如 /movie/slug
|
|
|
|
static func == (lhs: ContentItem, rhs: ContentItem) -> Bool {
|
|
lhs.id == rhs.id
|
|
}
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
hasher.combine(id)
|
|
}
|
|
}
|