using System; using System.Collections.Generic; using System.IO; using System.Linq; using API.Entities.Enums; using API.Entities.Interfaces; namespace API.Entities { public class Library : IEntityDate { public int Id { get; set; } public string Name { get; set; } /// /// Update this summary with a way it's used, else let's remove it. /// [Obsolete("This has never been coded for. Likely we can remove it.")] public string CoverImage { get; set; } public LibraryType Type { get; set; } public DateTime Created { get; set; } public DateTime LastModified { get; set; } /// /// Last time Library was scanned /// /// Time stored in UTC public DateTime LastScanned { get; set; } public ICollection Folders { get; set; } public ICollection AppUsers { get; set; } public ICollection Series { get; set; } // Methods /// /// Has there been any modifications to the FolderPath's directory since the date /// /// public bool AnyModificationsSinceLastScan() { // NOTE: I don't think we can do this due to NTFS return Folders.All(folder => File.GetLastWriteTimeUtc(folder.Path) > folder.LastScanned); } } }