60 lines
2.3 KiB
C#

using System.Text.Json.Serialization;
namespace View_by_Distance.PhotoPrism.Models;
public record Marker(
[property: JsonPropertyName("marker_uid")] string MarkerUid,
[property: JsonPropertyName("file_uid")] string FileUid,
[property: JsonPropertyName("marker_type")] string MarkerType,
[property: JsonPropertyName("marker_src")] string MarkerSrc,
[property: JsonPropertyName("marker_name")] string MarkerName,
[property: JsonPropertyName("marker_review")] string MarkerReview,
[property: JsonPropertyName("marker_invalid")] string MarkerInvalid,
[property: JsonPropertyName("subj_uid")] string SubjUid,
[property: JsonPropertyName("subj_src")] string SubjSrc,
[property: JsonPropertyName("face_id")] string FaceId,
[property: JsonPropertyName("face_dist")] string FaceDist,
[property: JsonPropertyName("x")] string X,
[property: JsonPropertyName("y")] string Y,
[property: JsonPropertyName("w")] string W,
[property: JsonPropertyName("h")] string H,
[property: JsonPropertyName("q")] string Q,
[property: JsonPropertyName("size")] string Size,
[property: JsonPropertyName("score")] string Score,
[property: JsonPropertyName("thumb")] string Thumb,
[property: JsonPropertyName("matched_at")] string MatchedAt,
[property: JsonPropertyName("created_at")] string CreatedAt,
[property: JsonPropertyName("updated_at")] string UpdatedAt)
{
internal static Shared.Models.Marker Map(Marker marker)
{
Shared.Models.Marker result;
(double x, double y, double w, double h, double score) = (double.Parse(marker.X), double.Parse(marker.Y), double.Parse(marker.W), double.Parse(marker.H), double.Parse(marker.Score));
result = new(
marker.MarkerUid,
marker.FileUid,
marker.MarkerType,
marker.MarkerSrc,
marker.MarkerName,
marker.MarkerReview,
marker.MarkerInvalid,
marker.SubjUid,
marker.SubjSrc,
marker.FaceId,
marker.FaceDist,
x,
y,
w,
h,
marker.Q,
marker.Size,
score,
marker.Thumb,
marker.MatchedAt,
marker.CreatedAt,
marker.UpdatedAt);
return result;
}
}