Files
Cleanuparr/code/backend/Cleanuparr.Persistence/Models/State/SeekerCommandTracker.cs
T

65 lines
2.0 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Cleanuparr.Domain.Enums;
using Cleanuparr.Persistence.Models.Configuration.Arr;
namespace Cleanuparr.Persistence.Models.State;
/// <summary>
/// Tracks arr command IDs returned from search requests so the SeekerCommandMonitor
/// can poll for completion status and inspect the download queue afterward.
/// </summary>
public sealed record SeekerCommandTracker
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; } = Guid.NewGuid();
/// <summary>
/// Foreign key to the arr instance this command was sent to
/// </summary>
public Guid ArrInstanceId { get; set; }
/// <summary>
/// The command ID returned by the arr API
/// </summary>
public long CommandId { get; set; }
/// <summary>
/// The AppEvent ID to update when the command completes
/// </summary>
public Guid EventId { get; set; }
/// <summary>
/// The library-level item that was searched (seriesId, movieId, albumId or bookId)
/// </summary>
public long ExternalItemId { get; set; }
/// <summary>
/// For Sonarr episode-level searches, the episode that was searched.
/// 0 when the search targeted a whole season, movie, album or book.
/// </summary>
public long EpisodeId { get; set; }
/// <summary>
/// Display name of the item that was searched
/// </summary>
public string ItemTitle { get; set; } = string.Empty;
/// <summary>
/// For Sonarr season-level searches, the season number that was searched.
/// 0 for Radarr or when not applicable.
/// </summary>
public int SeasonNumber { get; set; }
/// <summary>
/// When this tracker entry was created
/// </summary>
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
/// <summary>
/// Current status of the arr command
/// </summary>
public SearchCommandStatus Status { get; set; } = SearchCommandStatus.Pending;
}