42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace View_by_Distance.Shared.Models;
|
|
|
|
public class Closest : Properties.IClosest
|
|
{
|
|
|
|
protected readonly int _Average;
|
|
protected readonly bool? _IsWrongYear;
|
|
protected Mapping _Mapping;
|
|
protected readonly double _Minimum;
|
|
protected readonly DateTime _MinimumDateTime;
|
|
protected readonly int _NormalizedPixelPercentage;
|
|
protected readonly long? _TicksDelta;
|
|
public double Average => _Average;
|
|
public bool? IsWrongYear => _IsWrongYear;
|
|
public Mapping Mapping => _Mapping;
|
|
public double Minimum => _Minimum;
|
|
public DateTime MinimumDateTime => _MinimumDateTime;
|
|
public int NormalizedPixelPercentage => _NormalizedPixelPercentage;
|
|
public long? TicksDelta => _TicksDelta;
|
|
|
|
[JsonConstructor]
|
|
public Closest(int average, int normalizedPixelPercentage, bool? isWrongYear, Mapping mapping, double minimum, DateTime minimumDateTime, long? ticksDelta)
|
|
{
|
|
_Average = average;
|
|
_NormalizedPixelPercentage = normalizedPixelPercentage;
|
|
_IsWrongYear = isWrongYear;
|
|
_Mapping = mapping;
|
|
_Minimum = minimum;
|
|
_MinimumDateTime = minimumDateTime;
|
|
_TicksDelta = ticksDelta;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
|
return result;
|
|
}
|
|
|
|
} |