namespace ErsatzTV.Core.Domain;

public class LibraryFolder
{
    public int Id { get; set; }
    public string Path { get; set; }

    /// <summary>
    ///     SHA-256 hex of <see cref="Path" /> (<see cref="ErsatzTV.Core.PathUtils.GetPathHash" />), the
    ///     indexable stand-in for the unbounded <see cref="Path" /> column that backs the unique
    ///     <c>(LibraryPathId, PathHash)</c> constraint — the same shape as <c>MediaFile.PathHash</c>.
    ///     Nullable: rows created before ersatztv#491 carry <c>null</c> until a scan heals them, and a
    ///     unique index treats nulls as distinct so those legacy rows never collide.
    /// </summary>
    public string PathHash { get; set; }

    public int LibraryPathId { get; set; }
    public LibraryPath LibraryPath { get; set; }
    public int? ParentId { get; set; }
    public LibraryFolder Parent { get; set; }
    public ICollection<LibraryFolder> Children { get; set; }
    public ICollection<MediaFile> MediaFiles { get; set; }
    public ImageFolderDuration ImageFolderDuration { get; set; }
    public string Etag { get; set; }
}
