@using JSMR.UI.Blazor.Enums

<div class="@GetIconClasses()"></div>

@code {
    [Parameter]
    public Graphic Graphic { get; set; }

    [Parameter]
    public SizeVarient Size { get; set; } = SizeVarient.Medium;

    [Parameter]
    public IconVarient Varient { get; set; } = IconVarient.None;

    [Parameter]
    public ColorVarient Color { get; set; }

    private string GetIconClasses()
    {
        string graphic = Varient == IconVarient.None
            ? Graphic.ToString().ToLower()
            : $"{Graphic.ToString().ToLower()}-{Varient.ToString().ToLower()}";
        
        List<string> classNames =
        [
            $"j-icon",
            $"j-icon-{graphic}",
            $"j-icon-size-{Size.ToString().ToLower()}",
            $"background-color-{Color.ToString().ToLower()}"
        ];

        return string.Join(" ", classNames);
    }
}