using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Cleanuparr.Domain.Enums;
using Cleanuparr.Persistence.Models.Configuration.Arr;
namespace Cleanuparr.Persistence.Models.State;
///
/// Represents a pending reactive search request queued after a download removal.
/// The Seeker processes these items with priority before proactive searches.
///
public sealed record SearchQueueItem
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; } = Guid.NewGuid();
///
/// Foreign key to the arr instance this search targets
///
public Guid ArrInstanceId { get; set; }
///
/// Navigation property to the associated arr instance
///
///
public ArrInstance ArrInstance { get; set; } = null!;
///
/// The item ID to search for (movieId, episodeId, albumId, etc.)
///
public long ItemId { get; set; }
///
/// For Sonarr/Whisparr: the series ID when searching at episode/season level
///
public long? SeriesId { get; set; }
///
/// For Sonarr/Whisparr: the search type ("Episode" or "Season")
///
public string? SearchType { get; set; }
///
/// Display title for logging and event publishing
///
public string Title { get; set; } = "";
///
/// When this search request was created
///
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}