@code {
    [Parameter, Required] public FeTrack Track { get; set; }
    [Parameter] public bool ShowParam { get; set; }
}

@if (Track != null)
{
    var ex = Path.GetExtension(Track.Path?.ToLower());

    <span class="badge bg-secondary">
        @switch (ex)
        {
            case ".flac":
                <i class="bi bi-file-earmark-music"></i>
                break;
            case ".wav":
                <i class="bi bi-filetype-wav"></i>
                break;
            case ".m4a":
            case ".aac":
                <i class="bi bi-filetype-aac"></i>
                break;
            case ".mp3":
                <i class="bi bi-filetype-mp3"></i>
                break;
            case ".mp4":
                <i class="bi bi-filetype-mp4"></i>
                break;
            default:
                <i class="bi bi-file-earmark"></i>
                break;
        }
        @ex.Substring(1).ToUpper()

        @if (ShowParam && Track.Tag?.Bit > 0)
        {
            <span class="border-start ms-1 ps-1">@(Track.Tag.Bit)</span>
        }
    </span>

    @if (ShowParam && (Track.Tag?.BitRate > 0 || Track.Tag?.Freq > 0))
    {
        <span class="badge bg-secondary">
            @if (Track.Tag?.BitRate > 0)
            {
                @if (Track.Tag.BitRate < 1000)
                {
                    <span>@(Track.Tag.BitRate)k</span>
                }
                else
                {
                    <span>@($"{Track.Tag.BitRate / 1000f:N2}")m </span>
                }
            }

            @if (Track.Tag?.Freq > 0)
            {
                <span class="ms-1">@(Track.Tag.Freq / 100f)</span>
            }
        </span>
    }
}
