using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Cleanuparr.Domain.Enums; using Cleanuparr.Persistence.Models.Configuration.Arr; namespace Cleanuparr.Persistence.Models.State; /// /// Tracks the last time each media item was searched by the Seeker job. /// Used by selection strategies to prioritize items that haven't been searched recently. /// public sealed record SeekerHistory { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } = Guid.NewGuid(); /// /// Foreign key to the arr instance this history belongs to /// public Guid ArrInstanceId { get; set; } /// /// Navigation property to the associated arr instance /// public ArrInstance ArrInstance { get; set; } = null!; /// /// The external item ID in the arr application (e.g., Radarr movieId or Sonarr seriesId) /// public long ExternalItemId { get; set; } /// /// The type of arr instance this item belongs to /// public InstanceType ItemType { get; set; } /// /// For Sonarr season-level searches, the season number that was searched /// public int SeasonNumber { get; set; } /// /// The cycle ID. All searches in the same cycle share a CycleId. /// When all items have been searched, a new CycleId is generated to start a fresh cycle. /// public Guid CycleId { get; set; } /// /// When this item was last searched /// public DateTime LastSearchedAt { get; set; } /// /// Display name of the item (movie title, series name, etc.) /// public string ItemTitle { get; set; } = string.Empty; /// /// Running count of how many times this item has been searched /// public int SearchCount { get; set; } = 1; /// /// Whether this history entry was created during a dry run /// public bool IsDryRun { get; set; } }