//
//  DebugBorderModifier.swift
//  CasinoKit
//
//  Debug view modifier for visualizing layout boundaries.
//

import SwiftUI

// MARK: - Debug Border Modifier

public extension View {
    /// Adds a colored border and label to a view for debugging layout.
    /// - Parameters:
    ///   - show: Whether to show the debug border.
    ///   - color: The color of the border and label.
    ///   - label: The label text to display in the corner.
    /// - Returns: The view with an optional debug border overlay.
    @ViewBuilder
    func debugBorder(_ show: Bool, color: Color, label: String) -> some View {
        if show {
            self
                .overlay(
                    RoundedRectangle(cornerRadius: CasinoDesign.CornerRadius.xSmall)
                        .strokeBorder(color, lineWidth: CasinoDesign.LineWidth.thin)
                )
                .overlay(alignment: .topLeading) {
                    Text(label)
                        .font(.system(size: 8, weight: .bold))
                        .foregroundStyle(color)
                        .padding(2)
                        .background(Color.black.opacity(CasinoDesign.Opacity.strong))
                }
        } else {
            self
        }
    }
}

