@using DeepDrftModels.Enums
@inject NavigationManager Navigation

@* Release Archive: one card per ReleaseMedium, driven off Enum.GetValues + a display-metadata table.
   No hardcoded three-arm switch in markup — adding a medium surfaces a new card automatically and only
   needs one new entry in MediumCards below. Card idiom mirrors CmsGenreBrowser (MudCard + swatch). *@
<MudGrid Spacing="3" Class="mt-2">
    @foreach (var medium in Enum.GetValues<ReleaseMedium>())
    {
        var info = MediumCards[medium];
        <MudItem xs="12" sm="6" md="4">
            <MudCard Elevation="1"
                     Style="cursor: pointer;"
                     @onclick="@(() => Navigation.NavigateTo(info.Route))">
                <div class="@($"cms-medium-swatch cms-medium-swatch--{info.SwatchModifier}")"></div>
                <MudCardContent>
                    <MudText Typo="Typo.h6">@info.Label</MudText>
                    <MudText Typo="Typo.body2" Class="mud-text-secondary">@info.Descriptor</MudText>
                </MudCardContent>
            </MudCard>
        </MudItem>
    }
</MudGrid>

@code {
    private sealed record MediumCardInfo(string Label, string Descriptor, string SwatchModifier, string Route);

    // The one place medium → display + navigation target lives. A future medium adds one entry here;
    // the markup above is untouched. The enum→record dictionary is a switch, data-structured (§3.1).
    private static readonly IReadOnlyDictionary<ReleaseMedium, MediumCardInfo> MediumCards =
        new Dictionary<ReleaseMedium, MediumCardInfo>
        {
            [ReleaseMedium.Cut] = new("Cuts", "Studio singles, EPs, and albums", "cut", "/tracks/albums"),
            [ReleaseMedium.Session] = new("Sessions", "Single-track live recordings", "session", "/tracks/sessions"),
            [ReleaseMedium.Mix] = new("Mixes", "Single-track DJ mixes", "mix", "/tracks/mixes"),
        };
}
