import SwiftUI

public struct BadgeLabel: View {
    public enum Style {
        case primary // Pink
        case secondary // Gray
    }

    private let label: String
    private var style: Style

    public init(_ label: String, style: Style = .primary) {
        self.style = style
        self.label = label
    }

    public var body: some View {
        Text(label)
            .padding(.vertical, 2)
            .padding(.horizontal, 8)
            .foregroundStyle(style.foreground)
            .typographyV1(.subtitleSmall)
            .background(style.background)
            .clipShape(RoundedRectangle(cornerRadius: 34))
    }
}

extension BadgeLabel.Style {
    var background: Color {
        switch self {
        case .primary:
            Color.PaletteV2.pink600

        case .secondary:
            Color.SemanticV2.backgroundTertiary
        }
    }

    var foreground: Color {
        Color.SemanticV2.foregroundPrimary
    }
}
