//
//  NotificationMessageEditView.swift
//  TheNoiseClock
//
//  Created by Matt Bruce on 9/7/25.
//

import SwiftUI
import Bedrock

/// View for editing alarm notification message
struct NotificationMessageEditView: View {
    @Binding var message: String
    @Environment(\.dismiss) private var dismiss
    
    var body: some View {
        VStack(spacing: Design.Spacing.large) {
            TextField("Notification message", text: $message)
                .textFieldStyle(RoundedBorderTextFieldStyle())
                .contentPadding(horizontal: Design.Spacing.large)
            
            // Preview section
            VStack(alignment: .leading, spacing: Design.Spacing.small) {
                Text("Preview:")
                    .font(.headline)
                    .foregroundColor(.secondary)
                
                VStack(alignment: .leading, spacing: 4) {
                    Text("Alarm")
                        .font(.headline)
                        .foregroundColor(.primary)
                    
                    Text(message.isEmpty ? "Your alarm is ringing" : message)
                        .font(.body)
                        .foregroundColor(.secondary)
                }
                .padding()
                .background(Color(.systemGray6))
                .cornerRadius(8)
            }
            .contentPadding(horizontal: Design.Spacing.large)
            
            Spacer()
        }
        .navigationTitle("Message")
        .navigationBarTitleDisplayMode(.inline)
        .contentPadding(vertical: Design.Spacing.large)
    }
}

// MARK: - Preview
#Preview {
    NavigationStack {
        NotificationMessageEditView(message: .constant("Your alarm is ringing"))
    }
}
