import SwiftUI

struct HelpAndResourcesSection: View {
    var body: some View {
        VStack(alignment: .leading, spacing: ProatSpacing.s) {
            Text("Hulp en bronnen")
                .font(ProatFont.sectie)
                .foregroundColor(.proatText1)

            VStack(alignment: .leading, spacing: ProatSpacing.xs) {
                resourceLink(
                    icon: "exclamationmark.bubble.fill",
                    title: "Feedback of problemen?",
                    action: {
                        EmailSupport.openSupportEmail()
                    }
                )
            }
        }
        .frame(maxWidth: .infinity, alignment: .leading)
        .proatCard(padding: ProatSpacing.m)
    }
    
    private func resourceLink(icon: String, title: String, action: @escaping () -> Void) -> some View {
        Button(action: {
            action()
        }) {
            HStack {
                Image(systemName: icon)
                    .font(.system(size: 15, weight: .medium))
                    .foregroundColor(.proatTeal)
                    .frame(width: 20)

                Text(title)
                    .font(ProatFont.body)
                    .fontWeight(.semibold)
                    .foregroundColor(.proatText1)

                Spacer()

                Image(systemName: "arrow.up.right")
                    .font(ProatFont.klein)
                    .foregroundColor(.proatText3)
            }
            .padding(ProatSpacing.s)
            .background(Color.proatBgSunken)
            .clipShape(RoundedRectangle(cornerRadius: ProatRadius.knop, style: .continuous))

        }
        .buttonStyle(.plain)
    }
}
