import SwiftUI
import Bedrock

struct SectionHeaderView: View {
    private let title: String
    private let subtitle: String?

    init(title: String, subtitle: String? = nil) {
        self.title = title
        self.subtitle = subtitle
    }

    var body: some View {
        VStack(alignment: .leading, spacing: Design.Spacing.xxxSmall) {
            Text(title)
                .font(.headline)
                .foregroundStyle(AppTextColors.primary)
            if let subtitle {
                Text(subtitle)
                    .font(.subheadline)
                    .foregroundStyle(AppTextColors.secondary)
            }
        }
        .frame(maxWidth: .infinity, alignment: .leading)
        .accessibilityElement(children: .combine)
    }
}

#Preview {
    SectionHeaderView(title: "Preview", subtitle: "Subtitle")
        .padding(Design.Spacing.medium)
        .background(AppSurface.primary)
}
