-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSite.cs
More file actions
113 lines (98 loc) · 3.13 KB
/
Site.cs
File metadata and controls
113 lines (98 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Nhs.Appointments.Core.Geography;
namespace Nhs.Appointments.Core.Sites;
public record Site(
[JsonProperty("id")] string Id,
[JsonProperty("name")] string Name,
[JsonProperty("address")] string Address,
[JsonProperty("phoneNumber")] string PhoneNumber,
[JsonProperty("odsCode")] string OdsCode,
[JsonProperty("region")] string Region,
[JsonProperty("integratedCareBoard")] string IntegratedCareBoard,
[JsonProperty("informationForCitizens")] string InformationForCitizens,
[JsonProperty("accessibilities")] IEnumerable<Accessibility> Accessibilities,
[JsonProperty("location")] Location location,
[JsonProperty("status")] SiteStatus? status,
[JsonProperty("isDeleted")] bool? isDeleted,
[JsonProperty("type")] string Type,
int ReferenceNumberGroup
)
{
public IEnumerable<Accessibility> Accessibilities { get; set; } = Accessibilities?.Select(a => new Accessibility(a.Id, a.Value.ToLower()));
private Location Location { get; } = location;
[JsonIgnore]
public int ReferenceNumberGroup { get; } = ReferenceNumberGroup;
public Coordinates Coordinates
{
get
{
return Location?.Coordinates is not { Length: 2 }
? null
: new Coordinates { Longitude = Location.Coordinates[0], Latitude = Location.Coordinates[1] };
}
}
}
public record Location(
[property: JsonProperty("type")] string Type,
[property: JsonProperty("coordinates")]
double[] Coordinates
);
public record Accessibility(
[property: JsonProperty("id")] string Id,
[property: JsonProperty("value")] string Value
);
public record SiteWithDistance(
[JsonProperty("site")] Site Site,
[JsonProperty("distance")] int Distance
);
/// <summary>
/// Filter sites based on whether they support the provided service within the date range
/// </summary>
public record SiteSupportsServiceFilter(
List<string> services,
DateOnly from,
DateOnly until
);
public record AccessibilityRequest
(
[JsonProperty("accessibilities")]
IEnumerable<Accessibility> Accessibilities
);
public record InformationForCitizensRequest
(
[JsonProperty("informationForCitizens")]
string InformationForCitizens
);
public record SitePreview
(
[JsonProperty("id")]
string Id,
[JsonProperty("name")]
string Name,
[JsonProperty("odsCode")]
string OdsCode,
[JsonProperty("integratedCareBoard")]
string IntegratedCareBoard
);
public record DetailsRequest(
[JsonProperty("name")] string Name,
[JsonProperty("phoneNumber")] string PhoneNumber,
[JsonProperty("address")] string Address,
[JsonProperty("longitude")] string Longitude,
[JsonProperty("latitude")] string Latitude
);
public record ReferenceDetailsRequest(
[JsonProperty("odsCode")] string OdsCode,
[JsonProperty("icb")] string Icb,
[JsonProperty("region")] string Region
);
[JsonConverter(typeof(StringEnumConverter))]
public enum SiteStatus
{
[EnumMember(Value = "Online")]
Online,
[EnumMember(Value = "Offline")]
Offline
}