@using JSMR.Application.Tags.Queries.Search.Contracts
@using JSMR.Application.VoiceWorks.Queries.Search
@using JSMR.UI.Blazor.Enums
@using JSMR.UI.Blazor.Filters
@using JSMR.UI.Blazor.Services
@using Microsoft.AspNetCore.WebUtilities

<Chip Graphic="Graphic.Circle" Color="@GetColor()" Varient="ElementVarient.Outlined" Tone="@GetTone()" Url="@GetUrl()" Target="_blank">@Circle.Name</Chip>

@code {
    [Parameter]
    public required VoiceWorkCircleItem Circle { get; set; }

    private string GetUrl()
    {
        return $"https://www.dlsite.com/maniax/circle/profile/=/maker_id/{Circle.MakerId}.html";
    }

    private ColorVarient GetColor()
    {
        if (Circle.IsFavorite)
        {
            return ColorVarient.Mint;
        }

        if (Circle.IsBlacklisted)
        {
            return ColorVarient.Pink;
        }

        return ColorVarient.Secondary;
    }

    private ToneVarient GetTone()
    {
        if (Circle.IsFavorite || Circle.IsBlacklisted)
        {
            return ToneVarient.Tint;
        }

        return ToneVarient.None;
    }
}