import SwiftUI
import Bedrock

struct ColorSwatchButton: View {
    let color: Color
    let isSelected: Bool
    let action: () -> Void

    var body: some View {
        Button(action: action) {
            Circle()
                .fill(color)
                .frame(width: Design.CardSize.colorSwatchSize, height: Design.CardSize.colorSwatchSize)
                .overlay(
                    Circle()
                        .stroke(isSelected ? Color.accentColor : Color.Text.tertiary.opacity(Design.Opacity.light), lineWidth: isSelected ? Design.LineWidth.thick : Design.LineWidth.thin)
                )
                .overlay(
                    Circle()
                        .stroke(Color.AppBackground.elevated, lineWidth: Design.LineWidth.medium)
                        .padding(Design.LineWidth.thin)
                        .opacity(isSelected ? 1 : 0)
                )
        }
        .buttonStyle(.plain)
        .accessibilityLabel("Color swatch")
        .accessibilityAddTraits(isSelected ? [.isSelected] : [])
    }
}
