using Microsoft.AspNetCore.Components.Forms; namespace DeepDrftManager.Components.Pages.Tracks; /// /// A single track row shared by BatchUpload (all rows are new uploads) and /// BatchEdit (existing rows carry ; admins may also add new upload rows). /// public class BatchRowModel { /// SQL id of an existing track. null means a new row to upload. public long? Id { get; set; } /// Vault entry key — existing rows only. public string? EntryKey { get; set; } /// Original upload filename — existing rows only, read-only display. public string? OriginalFileName { get; set; } /// Selected WAV — new rows only. public IBrowserFile? WavFile { get; set; } public string TrackName { get; set; } = string.Empty; public int TrackNumber { get; set; } public BatchRowStatus Status { get; set; } = BatchRowStatus.Queued; public string? ErrorMessage { get; set; } /// Bytes pushed to the wire so far for this row's in-flight upload. Reset per attempt. public long UploadedBytes { get; set; } /// Total payload bytes for this row (the WAV file size), the progress denominator. public long TotalBytes { get; set; } /// Upload completion as a 0–100 percent, or 0 when the total is unknown. public int UploadPercent => TotalBytes > 0 ? (int)Math.Clamp(UploadedBytes * 100 / TotalBytes, 0, 100) : 0; } // Done is the terminal success state (track persisted + playable losslessly). PostProcessing is the // visible third upload phase (§3.1a): the byte transfer and server persist are finished and the track is // live, but the server-side background Opus transcode is still running. It is NOT a failure and never // blocks completion — the form may navigate away while a row sits in PostProcessing; the Releases browse // view polls the durable Opus status from there. public enum BatchRowStatus { Queued, Uploading, PostProcessing, Done, Failed }