import SwiftUI
import Bedrock

struct FieldTypeButton: View {
    let fieldType: ContactFieldType
    let themeColor: Color
    let action: () -> Void

    var body: some View {
        Button(action: action) {
            VStack(spacing: Design.Spacing.small) {
                Circle()
                    .fill(themeColor)
                    .frame(width: Design.CardSize.avatarSize, height: Design.CardSize.avatarSize)
                    .overlay(
                        fieldType.iconImage()
                            .typography(.title3)
                            .foregroundStyle(.white)
                    )

                Text(fieldType.displayName)
                    .typography(.caption)
                    .foregroundStyle(Color.Text.primary)
                    .multilineTextAlignment(.center)
                    .lineLimit(2)
                    .frame(height: Design.Spacing.xLarge * 2)
            }
        }
        .buttonStyle(.plain)
        .accessibilityLabel(fieldType.displayName)
    }
}
