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.
61 lines
1.9 KiB
61 lines
1.9 KiB
using System.Text.Json.Serialization;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Recyclarr.TrashGuide.ReleaseProfile;
|
|
|
|
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
|
|
public record TermData
|
|
{
|
|
[JsonPropertyName("trash_id")]
|
|
public string TrashId { get; init; } = string.Empty;
|
|
|
|
public string Name { get; init; } = string.Empty;
|
|
public string Term { get; init; } = string.Empty;
|
|
|
|
public sealed override string ToString()
|
|
{
|
|
return $"[TrashId: {TrashId}] [Name: {Name}] [Term: {Term}]";
|
|
}
|
|
}
|
|
|
|
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
|
|
public record PreferredTermData
|
|
{
|
|
public int Score { get; init; }
|
|
public IReadOnlyCollection<TermData> Terms { get; init; } = Array.Empty<TermData>();
|
|
|
|
public void Deconstruct(out int score, out IReadOnlyCollection<TermData> terms)
|
|
{
|
|
score = Score;
|
|
terms = Terms;
|
|
}
|
|
|
|
public sealed override string ToString()
|
|
{
|
|
return $"[Score: {Score}] [Terms: {Terms.Count}]";
|
|
}
|
|
}
|
|
|
|
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
|
|
public record ReleaseProfileData
|
|
{
|
|
[JsonPropertyName("trash_id")]
|
|
public string TrashId { get; init; } = string.Empty;
|
|
|
|
public string Name { get; init; } = string.Empty;
|
|
public bool IncludePreferredWhenRenaming { get; init; }
|
|
public IReadOnlyCollection<TermData> Required { get; init; } = Array.Empty<TermData>();
|
|
public IReadOnlyCollection<TermData> Ignored { get; init; } = Array.Empty<TermData>();
|
|
public IReadOnlyCollection<PreferredTermData> Preferred { get; init; } = Array.Empty<PreferredTermData>();
|
|
|
|
public sealed override string ToString()
|
|
{
|
|
return $"[TrashId: {TrashId}] " +
|
|
$"[Name: {Name}] " +
|
|
$"[IncludePreferred: {IncludePreferredWhenRenaming}] " +
|
|
$"[Required: {Required.Count}] " +
|
|
$"[Ignored: {Ignored.Count}] " +
|
|
$"[Preferred: {Preferred.Count}]";
|
|
}
|
|
}
|