using DeepDrftModels.DTOs;
using Models.Common;
using NetBlocks.Models;
namespace DeepDrftData;
///
/// SQL-side track service. Repository outputs entities; this service outputs DTOs via
/// TrackConverter. In-process consumers (UnifiedTrackService, CLI, DeepDrftPublic) all
/// receive DTOs.
///
public interface ITrackService
{
Task> GetById(long id);
Task> GetByEntryKey(string entryKey);
///
/// Returns a single track chosen uniformly at random, or null when the library is empty
/// (a valid state, not a failure). Backs the public "Stream Now" instant-play feature.
///
Task> GetRandom(CancellationToken cancellationToken = default);
Task>> GetAll();
Task>> GetPaged(int pageNumber, int pageSize, string? sortColumn, bool sortDescending, TrackFilter? filter = null, CancellationToken cancellationToken = default);
/// All releases, title-ascending, each carrying its non-deleted track count.
Task>> GetReleases(CancellationToken cancellationToken = default);
/// Distinct non-null genres with track counts, genre-ascending.
Task>> GetDistinctGenres(CancellationToken cancellationToken = default);
///
/// Resolve the release matching + , creating
/// one from when none exists. Backs the upload flow's FK
/// resolution so a track lands on a shared release rather than duplicating release-cardinal data.
///
Task> FindOrCreateRelease(
string title, string artist, ReleaseDto releaseData, CancellationToken cancellationToken = default);
Task> Create(TrackDto newTrack);
Task> Update(TrackDto track);
Task Delete(long id);
}