Files
Cleanuparr/code/backend/Cleanuparr.Persistence/Models/Configuration/Arr/ArrInstance.cs
2026-04-06 09:59:31 +03:00

37 lines
996 B
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using Cleanuparr.Shared.Attributes;
namespace Cleanuparr.Persistence.Models.Configuration.Arr;
public sealed class ArrInstance
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; } = Guid.NewGuid();
public bool Enabled { get; set; }
public float Version { get; set; }
public Guid ArrConfigId { get; set; }
public ArrConfig ArrConfig { get; set; } = null!;
public required string Name { get; set; }
public required Uri Url { get; set; }
public Uri? ExternalUrl { get; set; }
[SensitiveData]
public required string ApiKey { get; set; }
/// <summary>
/// Returns ExternalUrl if set, otherwise falls back to computed Url
/// </summary>
[NotMapped]
[JsonIgnore]
public Uri ExternalOrInternalUrl => ExternalUrl ?? Url;
}