//
//  ReflectMoodControlWidget.swift
//  ReflectWidget
//
//  Control Center widget for quick mood logging
//

import WidgetKit
import SwiftUI
import AppIntents

// MARK: - Control Center Widget

struct ReflectMoodControlWidget: ControlWidget {
    var body: some ControlWidgetConfiguration {
        StaticControlConfiguration(kind: "ReflectMoodControl") {
            ControlWidgetButton(action: OpenReflectIntent()) {
                Label("Log Mood", systemImage: "face.smiling")
            }
        }
        .displayName("Log Mood")
        .description("Open Reflect to log your mood")
    }
}

// MARK: - Open App Intent

struct OpenReflectIntent: AppIntent {
    static var title: LocalizedStringResource = "Open Reflect"
    static var description = IntentDescription("Open the Reflect app to log your mood")
    static var openAppWhenRun: Bool = true

    func perform() async throws -> some IntentResult {
        return .result()
    }
}
