-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAiring.swift
More file actions
78 lines (73 loc) · 1.9 KB
/
Copy pathAiring.swift
File metadata and controls
78 lines (73 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// Airing.swift
// PlayolaPlayer
//
// Created by Brian D Keane on 1/7/26.
//
import Foundation
/// Represents a scheduled airing of an episode
public struct Airing: Codable, Sendable, Equatable, Hashable, Identifiable {
public let id: String
public let episodeId: String
public let stationId: String
public let airtime: Date
public let createdAt: Date
public let updatedAt: Date
public let episode: Episode?
public let station: Station?
public init(
id: String,
episodeId: String,
stationId: String,
airtime: Date,
createdAt: Date,
updatedAt: Date,
episode: Episode? = nil,
station: Station? = nil
) {
self.id = id
self.episodeId = episodeId
self.stationId = stationId
self.airtime = airtime
self.createdAt = createdAt
self.updatedAt = updatedAt
self.episode = episode
self.station = station
}
}
extension Airing {
public static var mock: Airing {
Airing(
id: "mock-airing-id",
episodeId: "mock-episode-id",
stationId: "mock-station-id",
airtime: Date(timeIntervalSince1970: 1_800_000_000),
createdAt: Date(timeIntervalSince1970: 1_800_000_000),
updatedAt: Date(timeIntervalSince1970: 1_800_000_000),
episode: .mock,
station: .mock
)
}
public static func mockWith(
id: String? = nil,
episodeId: String? = nil,
stationId: String? = nil,
airtime: Date? = nil,
createdAt: Date? = nil,
updatedAt: Date? = nil,
episode: Episode?? = nil,
station: Station?? = nil
) -> Airing {
let mock = Self.mock
return Airing(
id: id ?? mock.id,
episodeId: episodeId ?? mock.episodeId,
stationId: stationId ?? mock.stationId,
airtime: airtime ?? mock.airtime,
createdAt: createdAt ?? mock.createdAt,
updatedAt: updatedAt ?? mock.updatedAt,
episode: episode ?? mock.episode,
station: station ?? mock.station
)
}
}