summaryrefslogtreecommitdiff
path: root/Sources/BubombCore/Models/AppSettings.swift
blob: 949ae75832da9e7d34ece95770d82839748005bd (plain)
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
import Foundation

public enum AnimationPreference: String, Codable, CaseIterable, Equatable, Sendable {
    case full = "Full (Sparks & Smoke)"
    case subtle = "Subtle (Sparks Only)"
    case none = "None (Reduced Motion)"
}

/// Persistent user configuration for Bubomb.
public struct AppSettings: Codable, Equatable, Sendable {
    public var activePayload: Payload?
    public var savedPayloads: [Payload]
    public var launchAtLogin: Bool
    public var startSilentlyInMenuBar: Bool
    public var animationPreference: AnimationPreference
    public var confirmDestructiveActions: Bool
    public var playCompletionFeedback: Bool
    public var recentExecutions: [ExecutionRecord]

    public static let currentVersion = "1.0.0"
    public static let buildNumber = "1"

    public init(
        activePayload: Payload? = nil,
        savedPayloads: [Payload] = [],
        launchAtLogin: Bool = false,
        startSilentlyInMenuBar: Bool = true,
        animationPreference: AnimationPreference = .full,
        confirmDestructiveActions: Bool = true,
        playCompletionFeedback: Bool = true,
        recentExecutions: [ExecutionRecord] = []
    ) {
        self.activePayload = activePayload
        self.savedPayloads = savedPayloads
        self.launchAtLogin = launchAtLogin
        self.startSilentlyInMenuBar = startSilentlyInMenuBar
        self.animationPreference = animationPreference
        self.confirmDestructiveActions = confirmDestructiveActions
        self.playCompletionFeedback = playCompletionFeedback
        self.recentExecutions = recentExecutions
    }

    public static var defaultSettings: AppSettings {
        AppSettings(
            activePayload: nil,
            savedPayloads: [],
            launchAtLogin: false,
            startSilentlyInMenuBar: true,
            animationPreference: .full,
            confirmDestructiveActions: true,
            playCompletionFeedback: true,
            recentExecutions: []
        )
    }
}