piwigodotnet/PiwigoDotnet/Piwigo.Client/Contract/CheckFilesResult.cs

20 lines
572 B
C#

using Newtonsoft.Json;
namespace Piwigo.Client.Contract;
public record CheckFilesResult
{
[JsonProperty("file")]
public string? File { get; init; }
public ImageCheckStatus ToImageCheckStatus()
{
return File?.ToLower() switch
{
"equals" => ImageCheckStatus.Equals,
"differs" => ImageCheckStatus.Differs,
"missing" => ImageCheckStatus.Missing,
_ => throw new PiwigoException($"Could not convert {File} to {nameof(ImageCheckStatus)} as the returned value is not supported")
};
}
}