import SwiftUI
import Bedrock

struct EmptyStateCardView: View {
    private let title: String
    private let message: String
    private let actionTitle: String
    private let action: () -> Void

    init(
        title: String,
        message: String,
        actionTitle: String,
        action: @escaping () -> Void
    ) {
        self.title = title
        self.message = message
        self.actionTitle = actionTitle
        self.action = action
    }

    var body: some View {
        VStack(alignment: .leading, spacing: Design.Spacing.medium) {
            Text(title)
                .font(.title3)
                .foregroundStyle(AppTextColors.primary)
                .bold()
            Text(message)
                .font(.body)
                .foregroundStyle(AppTextColors.secondary)
            Button(action: action) {
                Text(actionTitle)
                    .font(.headline)
                    .foregroundStyle(AppTextColors.primary)
                    .frame(maxWidth: .infinity)
                    .frame(height: AppMetrics.Size.buttonHeight)
                    .background(AppAccent.light.opacity(Design.Opacity.light))
                    .clipShape(.rect(cornerRadius: Design.CornerRadius.medium))
            }
            .accessibilityLabel(Text(actionTitle))
            .accessibilityHint(Text(String(localized: "Creates a new ritual")))
        }
        .padding(Design.Spacing.large)
        .background(AppSurface.card)
        .clipShape(.rect(cornerRadius: Design.CornerRadius.large))
    }
}

#Preview {
    EmptyStateCardView(
        title: "No ritual yet",
        message: "Start a four-week arc to keep your habits aligned.",
        actionTitle: "Create ritual",
        action: {}
    )
    .padding(Design.Spacing.large)
    .background(AppSurface.primary)
}
