using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace NexusReader.Domain.Entities; /// /// Represents an E-book uploaded or owned by a user. /// public class Ebook { [Key] public Guid Id { get; set; } = Guid.NewGuid(); [Required] [MaxLength(255)] public string Title { get; set; } = string.Empty; [Required] public int AuthorId { get; set; } [ForeignKey(nameof(AuthorId))] public virtual Author Author { get; set; } = null!; [Required] public string FilePath { get; set; } = string.Empty; public string? CoverUrl { get; set; } [Required] [MaxLength(128)] public string TenantId { get; set; } = "global"; public DateTime AddedDate { get; set; } = DateTime.UtcNow; public DateTime? LastReadDate { get; set; } public double Progress { get; set; } = 0; [MaxLength(255)] public string? LastChapter { get; set; } public int LastChapterIndex { get; set; } = 0; /// /// Gets or sets a value indicating whether the ebook has been processed by the AI ingestion engine /// and is ready for reading (Knowledge Units generated). /// public bool IsReadyForReading { get; set; } = false; // Relationship to NexusUser [Required] public string UserId { get; set; } = string.Empty; [ForeignKey(nameof(UserId))] public NexusUser? User { get; set; } }