//
//  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: String
    
    var body: some View {
        // Calculate size based on font weight - make dots smaller for lighter weights
        let sizeMultiplier = FontUtils.dotSizeMultiplier(for: fontWeight)
        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)
}
