Files

35 lines
1.3 KiB
C#

namespace DeepDrftModels.DTOs;
/// <summary>
/// Cross-project track filter contract. Threaded alongside (never inside) the external
/// <c>PagingParameters&lt;T&gt;</c>, which cannot carry a where-clause. An instance with all
/// properties null is equivalent to no filter — see <c>TrackFilter.IsEmpty</c>.
/// </summary>
public class TrackFilter
{
/// <summary>Free-text, case-insensitive LIKE across TrackName, Artist, and Album.</summary>
public string? SearchText { get; set; }
/// <summary>Exact album match.</summary>
public string? Album { get; set; }
/// <summary>Exact genre match.</summary>
public string? Genre { get; set; }
/// <summary>
/// Exact release-id match. The authoritative join from a release to its tracks — preferred over
/// <see cref="Album"/> (a title string that collides across same-titled releases and breaks on rename).
/// </summary>
public long? ReleaseId { get; set; }
/// <summary>
/// True when no predicate is set. An empty filter must produce identical results to a null
/// filter, so callers collapse it to null before querying.
/// </summary>
public bool IsEmpty =>
string.IsNullOrWhiteSpace(SearchText)
&& string.IsNullOrWhiteSpace(Album)
&& string.IsNullOrWhiteSpace(Genre)
&& ReleaseId is null;
}