File size: 1,114 Bytes
4977db2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Foundation

public struct PromptDaySummary: Identifiable, Hashable, Sendable {
    public var id: String { day }
    public let day: String
    public let count: Int

    public init(day: String, count: Int) {
        self.day = day
        self.count = count
    }
}

public struct PromptTopicSummary: Identifiable, Hashable, Sendable {
    public var id: String {
        guard let topic else { return "untagged" }
        return "tag:\(topic.folding(options: [.caseInsensitive], locale: Locale(identifier: "en_US_POSIX")).lowercased())"
    }
    public let topic: String?
    public let count: Int

    public init(topic: String?, count: Int) {
        self.topic = topic
        self.count = count
    }

    public var displayName: String { topic ?? "Ohne Tags" }
    public var isUntagged: Bool { topic == nil }
}

public struct PromptChronologySummary: Sendable {
    public let days: [PromptDaySummary]
    public let legacyUndatedCount: Int

    public init(days: [PromptDaySummary], legacyUndatedCount: Int) {
        self.days = days
        self.legacyUndatedCount = legacyUndatedCount
    }
}