//
//  KeepAwakePrompt.swift
//  TheNoiseClock
//
//  Created by Matt Bruce on 2/2/26.
//

import SwiftUI
import Bedrock

struct KeepAwakePrompt: View {
    let onEnable: () -> Void
    let onDismiss: () -> Void
    
    var body: some View {
        VStack(spacing: Design.Spacing.large) {
            Image(systemName: "bolt.fill")
                .font(.system(size: 36, weight: .semibold))
                .foregroundStyle(AppAccent.primary)
            
            VStack(spacing: Design.Spacing.small) {
                Text("Keep Awake for Alarms")
                    .typography(.title2)
                    .foregroundStyle(AppTextColors.primary)
                
                Text("Enable Keep Awake so your alarm can play loudly and show the full screen while TheNoiseClock stays open.")
                    .typography(.body)
                    .foregroundStyle(AppTextColors.secondary)
                    .multilineTextAlignment(.center)
            }
            
            VStack(spacing: Design.Spacing.small) {
                Button(action: onEnable) {
                    Text("Enable Keep Awake")
                        .frame(maxWidth: .infinity)
                }
                .buttonStyle(color: AppAccent.primary)
                
                Button(action: onDismiss) {
                    Text("Not Now")
                        .frame(maxWidth: .infinity)
                }
                .buttonStyle(.plain)
                .foregroundStyle(AppTextColors.secondary)
            }
        }
        .padding(Design.Spacing.xLarge)
        .frame(maxWidth: .infinity)
        .background(AppSurface.primary)
        .presentationDetents([.medium])
    }
}

#Preview {
    KeepAwakePrompt(onEnable: {}, onDismiss: {})
}
