summaryrefslogtreecommitdiff
path: root/octosentry/PersistedState.swift
blob: 3ef4234cf07c4c710b0bf08a270bf1f563189118 (plain) (blame)
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
//
//  PersistedState.swift
//  octosentry
//
//  Everything the app remembers across launches: the repo watch list,
//  local-only seen-state per event, last-fetch timestamp per repo, and the
//  minimum severity filter. Flat JSON over SwiftData (see #1) — small,
//  inspectable, and these are already plain Codable values passed across
//  actor boundaries, not reference types tied to a persistence context.
//

import Foundation

nonisolated struct PersistedState: Codable {
    var watchedRepos: [String]
    var seenEventIDs: Set<String>
    var lastFetchByRepo: [String: Date]
    var minimumSeverity: SecurityEventSeverity

    static let placeholder = PersistedState(
        watchedRepos: ["ccleberg/cleberg.net"],
        seenEventIDs: [],
        lastFetchByRepo: [:],
        minimumSeverity: .low
    )
}