Files
Cleanuparr/code/backend/Cleanuparr.Persistence/Models/Configuration/DownloadCleaner/QBitSeedingRule.cs
T

67 lines
2.0 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Cleanuparr.Domain.Enums;
namespace Cleanuparr.Persistence.Models.Configuration.DownloadCleaner;
public sealed record QBitSeedingRule : ISeedingRule, ITagFilterable, ISeedersFilterable, IInactivityFilterable
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; } = Guid.NewGuid();
public Guid DownloadClientConfigId { get; set; }
public DownloadClientConfig DownloadClientConfig { get; set; } = null!;
public string Name { get; set; } = string.Empty;
public List<string> Categories { get; set; } = [];
public List<string> TrackerPatterns { get; set; } = [];
public List<string> TagsAny { get; set; } = [];
public List<string> TagsAll { get; set; } = [];
public int Priority { get; set; }
/// <summary>
/// Which torrent privacy types this rule applies to.
/// </summary>
public TorrentPrivacyType PrivacyType { get; set; } = TorrentPrivacyType.Public;
/// <summary>
/// Max ratio before removing a download.
/// </summary>
public double MaxRatio { get; set; } = -1;
/// <summary>
/// Min number of hours to seed before removing a download, if the ratio has been met.
/// </summary>
public double MinSeedTime { get; set; }
/// <summary>
/// Number of hours to seed before removing a download.
/// </summary>
public double MaxSeedTime { get; set; } = -1;
/// <inheritdoc/>
public int MinSeeders { get; set; }
/// <inheritdoc/>
public double MaxInactiveDays { get; set; } = -1;
/// <summary>
/// Whether to delete the source files when cleaning the download.
/// </summary>
public bool DeleteSourceFiles { get; set; }
public void Validate()
{
((ISeedingRule)this).ValidateRule();
((ISeedersFilterable)this).ValidateRule();
((IInactivityFilterable)this).ValidateRule();
}
}