You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.TrashLib/Pipelines/CustomFormat/Models/CustomFormatData.cs

53 lines
1.8 KiB

using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
using Recyclarr.Common.Extensions;
using Recyclarr.TrashLib.Json;
namespace Recyclarr.TrashLib.Pipelines.CustomFormat.Models;
public record CustomFormatFieldData
{
public string Name { get; } = nameof(Value).ToCamelCase();
public object? Value { get; init; }
}
public record CustomFormatSpecificationData
{
public string Name { get; init; } = "";
public string Implementation { get; init; } = "";
public bool Negate { get; init; }
public bool Required { get; init; }
[JsonConverter(typeof(FieldsArrayJsonConverter))]
public IReadOnlyCollection<CustomFormatFieldData> Fields { get; init; } = Array.Empty<CustomFormatFieldData>();
}
public record CustomFormatData
{
public static CustomFormatDataEqualityComparer Comparer { get; } = new();
[JsonIgnore]
public string? Category { get; init; }
[JsonIgnore]
public string FileName { get; init; } = "";
[JsonProperty("trash_id")]
[JsonNoSerialize]
[SuppressMessage("Design", "CA1044:Properties should not be write only",
Justification = "We want to deserialize but not serialize this property")]
public string TrashId { internal get; init; } = "";
[JsonProperty("trash_score")]
[JsonNoSerialize]
[SuppressMessage("Design", "CA1044:Properties should not be write only",
Justification = "We want to deserialize but not serialize this property")]
public int? TrashScore { internal get; init; }
public int Id { get; set; }
public string Name { get; init; } = "";
public bool IncludeCustomFormatWhenRenaming { get; init; }
public IReadOnlyCollection<CustomFormatSpecificationData> Specifications { get; init; } =
Array.Empty<CustomFormatSpecificationData>();
}