//
//  ExpandedControlItem.swift
//  CameraTester
//
//  Created by Matt Bruce on 1/2/26.
//

import SwiftUI
import Bedrock

// MARK: - Expanded Control Item

struct ExpandedControlItem: View {
    let icon: String
    let label: String
    let isActive: Bool
    let action: () -> Void

    // Layout constants
    private let iconSize: CGFloat = 28
    private let buttonSize: CGFloat = 56
    private let labelFontSize: CGFloat = 10

    var body: some View {
        Button(action: action) {
            VStack(spacing: Design.Spacing.xSmall) {
                ZStack {
                    Circle()
                        .fill(isActive ? Color.yellow : Color.black.opacity(Design.Opacity.light))
                        .frame(width: buttonSize, height: buttonSize)

                    Image(systemName: icon)
                        .font(.system(size: iconSize, weight: .medium))
                        .foregroundStyle(isActive ? Color.black : Color.white)
                }

                Text(label)
                    .font(.system(size: labelFontSize, weight: .medium))
                    .foregroundStyle(isActive ? Color.yellow : Color.white)
            }
        }
        .accessibilityLabel("\(label)")
        .accessibilityValue(isActive ? "On" : "Off")
    }
}
