1pub mod grid_json {
18
19 use serde::{Serialize, Deserialize};
20
21 #[derive(Serialize, Deserialize)]
22 pub struct GridJson {
23 #[serde(rename = "@context")]
24 pub context: Vec<ContextElement>,
25
26 pub id: String,
27
28 #[serde(rename = "type")]
29 pub grid_json_type: String,
30
31 pub geometry: Geometry,
32
33 pub properties: GridJsonProperties,
34 }
35
36 #[derive(Serialize, Deserialize)]
37 #[serde(untagged)]
38 pub enum ContextElement {
39 ContextClass(ContextClass),
40
41 String(String),
42 }
43
44 #[derive(Serialize, Deserialize)]
45 #[serde(rename_all = "camelCase")]
46 pub struct ContextClass {
47 #[serde(rename = "@version")]
48 version: String,
49
50 wx: String,
51
52 s: String,
53
54 geo: String,
55
56 unit: String,
57
58 #[serde(rename = "@vocab")]
59 vocab: String,
60
61 geometry: Distance,
62
63 city: String,
64
65 state: String,
66
67 distance: Distance,
68
69 bearing: CountyClass,
70
71 value: Value,
72
73 unit_code: Distance,
74
75 forecast_office: CountyClass,
76
77 forecast_grid_data: CountyClass,
78
79 public_zone: CountyClass,
80
81 county: CountyClass,
82 }
83
84 #[derive(Serialize, Deserialize)]
85 pub struct CountyClass {
86 #[serde(rename = "@type")]
87 bearing_type: String,
88 }
89
90 #[derive(Serialize, Deserialize)]
91 pub struct Distance {
92 #[serde(rename = "@id")]
93 id: String,
94
95 #[serde(rename = "@type")]
96 distance_type: String,
97 }
98
99 #[derive(Serialize, Deserialize)]
100 pub struct Value {
101 #[serde(rename = "@id")]
102 id: String,
103 }
104
105 #[derive(Serialize, Deserialize)]
106 pub struct Geometry {
107 #[serde(rename = "type")]
108 geometry_type: String,
109
110 coordinates: Vec<f64>,
111 }
112
113 #[derive(Serialize, Deserialize)]
114 #[serde(rename_all = "camelCase")]
115 pub struct GridJsonProperties {
116 #[serde(rename = "@id")]
117 id: String,
118
119 #[serde(rename = "@type")]
120 properties_type: String,
121
122 cwa: String,
123
124 pub forecast_office: String,
125
126 pub grid_id: String,
127
128 pub grid_x: i64,
129
130 pub grid_y: i64,
131
132 pub forecast: String,
133
134 forecast_hourly: String,
135
136 forecast_grid_data: String,
137
138 observation_stations: String,
139
140 relative_location: RelativeLocation,
141
142 forecast_zone: String,
143
144 time_zone: String,
145
146 radar_station: String,
147 }
148
149 #[derive(Serialize, Deserialize)]
150 pub struct RelativeLocation {
151 #[serde(rename = "type")]
152 relative_location_type: String,
153
154 geometry: Geometry,
155
156 properties: RelativeLocationProperties,
157 }
158
159 #[derive(Serialize, Deserialize)]
160 pub struct RelativeLocationProperties {
161 city: String,
162
163 state: String,
164
165 distance: DistanceClass,
166
167 bearing: DistanceClass,
168 }
169
170 #[derive(Serialize, Deserialize)]
171 #[serde(rename_all = "camelCase")]
172 pub struct DistanceClass {
173 unit_code: String,
174
175 value: f64,
176 }
177}