37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace View_by_Distance.Shared.Models;
|
|
|
|
public record class Sorting : Properties.ISorting
|
|
{
|
|
|
|
public bool? CanReMap { init; get; }
|
|
public int DaysDelta { init; get; }
|
|
public int DistancePermyriad { init; get; }
|
|
public int Id { init; get; }
|
|
public bool Older { init; get; }
|
|
public int WholePercentages { init; get; }
|
|
|
|
[JsonConstructor]
|
|
public Sorting(bool? canReMap, int daysDelta, int distancePermyriad, int id, bool older, int wholePercentages)
|
|
{
|
|
CanReMap = canReMap;
|
|
DaysDelta = daysDelta;
|
|
DistancePermyriad = distancePermyriad;
|
|
Id = id;
|
|
Older = older;
|
|
WholePercentages = wholePercentages;
|
|
}
|
|
|
|
public Sorting(Mapping mapping, MappingFromLocation mappingFromLocation) :
|
|
this(null, 0, 0, mapping.MappingFromItem.Id, false, mappingFromLocation.WholePercentages)
|
|
{ }
|
|
|
|
public override string ToString()
|
|
{
|
|
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
|
return result;
|
|
}
|
|
|
|
} |