mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-11-05 05:43:35 -05:00
32 lines
937 B
C#
32 lines
937 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Cleanuparr.Domain.Enums;
|
|
using Cleanuparr.Domain.Exceptions;
|
|
|
|
namespace Cleanuparr.Persistence.Models.Configuration.Arr;
|
|
|
|
public class ArrConfig : IConfig
|
|
{
|
|
[Key]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
|
|
|
public required InstanceType Type { get; set; }
|
|
|
|
public short FailedImportMaxStrikes { get; set; } = -1;
|
|
|
|
public List<ArrInstance> Instances { get; set; } = [];
|
|
|
|
public void Validate()
|
|
{
|
|
if (FailedImportMaxStrikes < -1)
|
|
{
|
|
throw new CustomValidationException("Failed import max strikes must be -1 or greater");
|
|
}
|
|
|
|
if (FailedImportMaxStrikes is > 0 and < 3)
|
|
{
|
|
throw new CustomValidationException("The minimum value for failed import max strikes must be 3");
|
|
}
|
|
}
|
|
} |