using Models.Entities;

namespace DeepDrftModels.Entities;

// Inherits Id, CreatedAt, UpdatedAt, IsDeleted from BaseEntity (Cerebellum.BlazorBlocks.Models).
// BaseEntity ships the audit columns but does not declare IEntity itself, so subclasses
// declare it explicitly to satisfy the generic constraints on Repository<>/Manager<>/etc.
//
// Track-cardinal data only (Phase 8 §8.0). Release-cardinal fields (Artist, Album→Title, Genre,
// ReleaseDate, ImagePath, ReleaseType, CreatedByUserId) live on ReleaseEntity, reached via the
// nullable Release navigation; ReleaseId is null for singles and loose tracks.
public class TrackEntity : BaseEntity, IEntity
{
    public required string EntryKey { get; set; }
    public required string TrackName { get; set; }
    public string? OriginalFileName { get; set; }
    public int TrackNumber { get; set; } = 1;
    // Audio runtime in seconds, extracted by the processor at upload (AudioBinary.Duration) and
    // persisted here so aggregate queries (e.g. total mix runtime) read it from SQL rather than the
    // vault. Nullable: rows that predate this column are valid until the one-time backfill populates them.
    public double? DurationSeconds { get; set; }
    public long? ReleaseId { get; set; }
    public ReleaseEntity? Release { get; set; }
}
