using DeepDrftModels.DTOs;
using Models.Common;
using NetBlocks.Models;
namespace DeepDrftManager.Services;
///
/// CMS-side track operations for the Manager host. Every read and write goes over HTTP to the
/// DeepDrftAPI API, which is the single authority over both the SQL metadata store and the
/// binary audio vault. DeepDrftManager holds no in-process data layer.
///
public interface ICmsTrackService
{
///
/// Proxy a WAV upload to DeepDrftAPI. The Content API owns the dual-database write and
/// returns the persisted track carrying the SQL-assigned Id. A vault-without-SQL
/// orphan is handled and logged server-side; here it surfaces as a failed result.
/// is the browser's filename, captured at upload time and
/// stored as metadata; it is not user-editable afterwards.
///
Task> UploadTrackAsync(
Stream wavStream,
string fileName,
string contentType,
string trackName,
string artist,
string? album,
string? genre,
string? releaseDate,
string? originalFileName,
long createdByUserId,
CancellationToken ct = default);
///
/// Delete a track via the Content API, which removes the SQL row then the vault entry.
/// Maps a 404 to a "Track not found." failure.
///
Task DeleteTrackAsync(long id, CancellationToken ct = default);
///
/// Fetch a page of track metadata from the Content API's GET api/track/page.
///
Task>> GetPagedAsync(
int page, int pageSize, string? sortColumn, bool sortDescending,
CancellationToken ct = default);
///
/// Fetch a single track's metadata from GET api/track/meta/{id}. A 404 returns a
/// passing result with a null value.
///
Task> GetByIdAsync(long id, CancellationToken ct = default);
///
/// Upload a cover-art image to the images vault via POST api/image/upload.
/// Returns the generated entry key on success. Maps a 400 to a validation failure message.
///
Task> UploadImageAsync(
Stream imageStream,
string fileName,
string contentType,
CancellationToken ct = default);
///
/// Update a track's metadata via PUT api/track/meta/{id}. EntryKey is immutable and
/// not part of the update. is tri-state: null leaves the
/// cover art unchanged, "" clears it, and any other value sets it.
///
Task UpdateAsync(
long id, string trackName, string artist,
string? album, string? genre, DateOnly? releaseDate,
string? imagePath = null,
CancellationToken ct = default);
///
/// Fetch per-track waveform profile status from GET api/track/waveform-status for the
/// CMS PreProcessing panel. Unpaged — the admin catalogue is small.
///
Task> GetWaveformStatusAsync(CancellationToken ct = default);
///
/// Trigger waveform profile generation for a single track via
/// POST api/track/{entryKey}/waveform. Maps a 404 to a "Track audio not found." failure.
///
Task GenerateWaveformProfileAsync(string entryKey, CancellationToken ct = default);
}