@inherits ComponentBase

<span class="@PillClass px-2 py-1 text-xs font-medium rounded-full">
    @StatusText
</span>

@code {
    /// <summary>
    /// Set to true to show the pill as enabled.
    /// </summary>
    [Parameter]
    public bool Enabled { get; set; }

    /// <summary>
    /// The text to show when the pill is enabled.
    /// </summary>
    [Parameter]
    public string TextTrue { get; set; } = "Enabled";

    /// <summary>
    /// The text to show when the pill is disabled.
    /// </summary>
    [Parameter]
    public string TextFalse { get; set; } = "Disabled";

    /// <summary>
    /// Optional color override: "green", "yellow", "red". If not specified, uses Enabled parameter.
    /// </summary>
    [Parameter]
    public string? Color { get; set; }

    private string PillClass
    {
        get
        {
            if (!string.IsNullOrEmpty(Color))
            {
                return Color.ToLower() switch
                {
                    "green" => "bg-green-100 text-green-800",
                    "yellow" => "bg-yellow-100 text-yellow-800",
                    "red" => "bg-red-100 text-red-800",
                    _ => "bg-gray-100 text-gray-800"
                };
            }

            return Enabled
                ? "bg-green-100 text-green-800"
                : "bg-red-100 text-red-800";
        }
    }

    private string StatusText => Enabled ? TextTrue : TextFalse;
}
