← All repositories

reportage

A life-logging app for iPhone

git clone https://code.inqk.net/reportage.git


Shared/Models/Report.swift (1236B)

1import Foundation
2
3/// One report: a moment in time, the answers given about it and the context
4/// captured with it.
5struct Report: Hashable, Sendable {
6    /// Imported reports keep Reporter's `uniqueIdentifier`, which makes
7    /// re-importing idempotent.
8    var id: UUID
9    /// The moment being described: when the prompt fired or the passive log
10    /// was tapped, not when the survey was finished.
11    var date: Date
12    /// IANA identifier of the zone the report was made in.
13    var timeZone: String
14    var kind: ReportKind
15    var trigger: ReportTrigger
16    var state: ReportState
17    var promptedAt: Date?
18    var completedAt: Date?
19    var context = Context()
20    var responses: [Response] = []
21    var modifiedAt: Date
22}
23
24enum ReportKind: String, Codable, Sendable, CaseIterable {
25    case random
26    case wake
27    case bedtime
28    case manual
29}
30
31enum ReportTrigger: String, Codable, Sendable, CaseIterable {
32    case notification
33    case app
34    case watch
35    /// Shortcuts, Control Center, the Action button and other App Intent
36    /// surfaces.
37    case intent
38    case imported
39}
40
41enum ReportState: String, Codable, Sendable, CaseIterable {
42    /// Logged, awaiting answers.
43    case passive
44    case complete
45}