//
//  DotCircle.swift
//  TheNoiseClock
//
//  Created by Matt Bruce on 9/9/25.
//

import SwiftUI

/// Component for displaying a single dot in the colon separator
struct DotCircle: View {
    let size: CGFloat
    let opacity: Double
    let digitColor: Color
    let glowIntensity: Double
    let fontWeight: Font.Weight
    
    var body: some View {
        // Calculate size based on font weight - make dots smaller for lighter weights
        let sizeMultiplier = 0.2
        let adjustedSize = size * sizeMultiplier
        
        ZStack {
            Circle()
                .fill(digitColor)
                .frame(width: adjustedSize, height: adjustedSize)
                .blur(radius: ColorUtils.glowRadius(intensity: glowIntensity))
                .opacity(ColorUtils.glowOpacity(intensity: glowIntensity) * opacity)
            Circle()
                .fill(digitColor)
                .frame(width: adjustedSize, height: adjustedSize)
                .opacity(opacity)
        }
    }
}

// MARK: - Preview
#Preview("Small Dot") {
    DotCircle(
        size: 8,
        opacity: 1.0,
        digitColor: .white,
        glowIntensity: 0.3,
        fontWeight: .light
    )
    .background(Color.black)
}

#Preview("Large Dot") {
    DotCircle(
        size: 12,
        opacity: 1.0,
        digitColor: .white,
        glowIntensity: 0.3,
        fontWeight: .bold
    )
    .background(Color.black)
}

#Preview("Multiple Dots") {
    HStack(spacing: 10) {
        DotCircle(
            size: 10,
            opacity: 1.0,
            digitColor: .white,
            glowIntensity: 0.3,
            fontWeight: .regular
        )
        DotCircle(
            size: 10,
            opacity: 1.0,
            digitColor: .white,
            glowIntensity: 0.3,
            fontWeight: .regular
        )
    }
    .background(Color.black)
}
