using System; using System.Collections.Generic; using API.Entities.Interfaces; using API.Extensions; using API.Services.Tasks.Scanner.Parser; namespace API.Entities; public class Volume : IEntityDate, IHasReadTimeEstimate { public int Id { get; set; } /// /// A String representation of the volume number. Allows for floats. Can also include a range (1-2). /// /// For Books with Series_index, this will map to the Series Index. public required string Name { get; set; } /// /// This is just the original Parsed volume number for lookups /// public string LookupName { get; set; } /// /// The minimum number in the Name field in Int form /// /// Removed in v0.7.13.8, this was an int and we need the ability to have 0.5 volumes render on the UI [Obsolete("Use MinNumber and MaxNumber instead")] public int Number { get; set; } /// /// The minimum number in the Name field /// public required float MinNumber { get; set; } /// /// The maximum number in the Name field (same as Minimum if Name isn't a range) /// public required float MaxNumber { get; set; } public IList Chapters { get; set; } = null!; public DateTime Created { get; set; } public DateTime LastModified { get; set; } public DateTime CreatedUtc { get; set; } public DateTime LastModifiedUtc { get; set; } /// /// Absolute path to the (managed) image file /// /// The file is managed internally to Kavita's APPDIR public string? CoverImage { get; set; } /// /// Total pages of all chapters in this volume /// public int Pages { get; set; } /// /// Total Word count of all chapters in this volume. /// /// Word Count is only available from EPUB files public long WordCount { get; set; } public int MinHoursToRead { get; set; } public int MaxHoursToRead { get; set; } public int AvgHoursToRead { get; set; } // Relationships public Series Series { get; set; } = null!; public int SeriesId { get; set; } /// /// Returns the Chapter Number. If the chapter is a range, returns that, formatted. /// /// public string GetNumberTitle() { if (MinNumber.Is(MaxNumber)) { return $"{MinNumber}"; } return $"{MinNumber}-{MaxNumber}"; } }