31 lines
1.4 KiB
C#
31 lines
1.4 KiB
C#
using DeepDrftModels.DTOs;
|
|
using DeepDrftModels.Enums;
|
|
|
|
namespace DeepDrftPublic.Client.Common;
|
|
|
|
/// <summary>
|
|
/// The single source of truth for a release's dedicated detail route (Phase 11 §2). A release
|
|
/// resolves to its per-medium detail page purely from its id and <see cref="ReleaseMedium"/> — no
|
|
/// round-trip needed at call sites that already hold the medium (Archive cards, AlbumsView cards,
|
|
/// the player-bar title). The thin <c>/tracks/{id}</c> redirect page fetches by id to discover the
|
|
/// medium, then resolves through this same helper, so the medium→route table lives in exactly one
|
|
/// place.
|
|
/// </summary>
|
|
public static class ReleaseRoutes
|
|
{
|
|
/// <summary>
|
|
/// The dedicated detail route for a release: <c>/cuts/{id}</c>, <c>/sessions/{id}</c>, or
|
|
/// <c>/mixes/{id}</c>. Cut is the default arm so a new medium without an entry here surfaces a
|
|
/// build-visible gap rather than a silent fallthrough — extend the switch when a fourth medium lands.
|
|
/// </summary>
|
|
public static string DetailHref(long id, ReleaseMedium medium) => medium switch
|
|
{
|
|
ReleaseMedium.Session => $"/sessions/{id}",
|
|
ReleaseMedium.Mix => $"/mixes/{id}",
|
|
_ => $"/cuts/{id}",
|
|
};
|
|
|
|
/// <summary>Convenience overload for call sites holding a <see cref="ReleaseDto"/>.</summary>
|
|
public static string DetailHref(ReleaseDto release) => DetailHref(release.Id, release.Medium);
|
|
}
|