namespace DeepDrftModels.Enums;
///
/// The allowed track-count range for a , expressed as an inclusive
/// [Min, Max] band. Max == int.MaxValue denotes an unbounded (many-track) medium.
///
public readonly record struct MediumCardinality(int Min, int Max)
{
/// True when falls within the inclusive band.
public bool Allows(int trackCount) => trackCount >= Min && trackCount <= Max;
/// True when the medium permits exactly one track (Max capped at 1).
public bool IsSingleTrack => Max == 1;
}
///
/// Single source of truth for per-medium structural rules. Today it declares track cardinality;
/// the same table is read by the upload service (to reject over-limit track-adds) and the CMS
/// batch forms (to decide whether to collapse the master list to one row), so the two cannot
/// drift. A future medium declares its cardinality here — and only here — and every consumer
/// honours it automatically. Pure declaration, no dependencies.
///
public static class MediumRules
{
private static readonly IReadOnlyDictionary Cardinalities =
new Dictionary
{
[ReleaseMedium.Cut] = new(1, int.MaxValue),
[ReleaseMedium.Session] = new(1, 1),
[ReleaseMedium.Mix] = new(1, 1),
};
/// The declared track-count band for .
public static MediumCardinality CardinalityOf(ReleaseMedium medium) => Cardinalities[medium];
}