Skip to main content

fhir_types/r6/
availability.rs

1// @generated by fhir-codegen from hl7.fhir.r6.core 6.0.0-ballot5. DO NOT EDIT.
2// Change the emitter (tools/fhir-codegen) and regenerate.
3// SPDX-FileCopyrightText: Cadasto B.V.
4// SPDX-License-Identifier: Apache-2.0
5//! Availability data for an {item}
6
7/// Availability data for an {item}
8///
9/// Availability data for an {item}, declaring what days/times are available,
10/// and any exceptions. The exceptions could be textual only, e.g. Public
11/// holidays, or could be time period specific and indicate a specific years
12/// dates.
13#[derive(Debug, Clone, Default, PartialEq, Eq)]
14pub struct Availability {
15    /// Unique id for inter-element referencing
16    ///
17    /// Unique id for the element within a resource (for internal references). This
18    /// may be any string value that does not contain spaces.
19    pub id: Option<std::string::String>,
20    /// Additional content defined by implementations
21    ///
22    /// May be used to represent additional information that is not part of the
23    /// basic definition of the element. To make the use of extensions safe and
24    /// managable, there is a strict set of governance applied to the definition and
25    /// use of extensions. Though any implementer can define an extension, there is
26    /// a set of requirements that SHALL be met as part of the definition of the
27    /// extension.
28    pub extension: Vec<super::extension::Extension>,
29    /// When the availability applies
30    ///
31    /// The period of time when the availability is applicable. For example, you
32    /// might use this property to indicate the period during the holiday season
33    /// when you close an hour early.
34    pub period: Option<super::period::Period>,
35    /// Times the {item} is available
36    ///
37    /// A collection of times that the {item} is available.
38    pub available_time: Vec<AvailabilityAvailableTime>,
39    /// Not available during this time due to provided reason
40    ///
41    /// The {item} is not available during this period of time due to the provided
42    /// reason.
43    pub not_available_time: Vec<AvailabilityNotAvailableTime>,
44}
45
46impl super::super::codec::Json for Availability {
47    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
48        let mut object = super::super::codec::Object::new();
49        if let Some(v) = &self.id {
50            object.insert(
51                std::string::String::from("id"),
52                super::super::codec::Value::String(v.clone()),
53            );
54        }
55        if !self.extension.is_empty() {
56            let mut items = Vec::with_capacity(self.extension.len());
57            for item in &self.extension {
58                items.push(super::super::codec::Value::Object(
59                    super::super::codec::Json::to_json(item)?,
60                ));
61            }
62            object.insert(
63                std::string::String::from("extension"),
64                super::super::codec::Value::Array(items),
65            );
66        }
67        if let Some(item) = &self.period {
68            object.insert(
69                std::string::String::from("period"),
70                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
71            );
72        }
73        if !self.available_time.is_empty() {
74            let mut items = Vec::with_capacity(self.available_time.len());
75            for item in &self.available_time {
76                items.push(super::super::codec::Value::Object(
77                    super::super::codec::Json::to_json(item)?,
78                ));
79            }
80            object.insert(
81                std::string::String::from("availableTime"),
82                super::super::codec::Value::Array(items),
83            );
84        }
85        if !self.not_available_time.is_empty() {
86            let mut items = Vec::with_capacity(self.not_available_time.len());
87            for item in &self.not_available_time {
88                items.push(super::super::codec::Value::Object(
89                    super::super::codec::Json::to_json(item)?,
90                ));
91            }
92            object.insert(
93                std::string::String::from("notAvailableTime"),
94                super::super::codec::Value::Array(items),
95            );
96        }
97        Ok(object)
98    }
99
100    fn from_json(
101        object: &super::super::codec::Object,
102        path: &mut super::super::codec::Path,
103    ) -> Result<Self, super::super::codec::DecodeError> {
104        let mut raw_id: Option<&super::super::codec::Value> = None;
105        let mut raw_extension: Option<&super::super::codec::Value> = None;
106        let mut raw_period: Option<&super::super::codec::Value> = None;
107        let mut raw_available_time: Option<&super::super::codec::Value> = None;
108        let mut raw_not_available_time: Option<&super::super::codec::Value> = None;
109        for (key, value) in object {
110            match key.as_str() {
111                "id" => {
112                    raw_id = Some(value);
113                }
114                "extension" => {
115                    raw_extension = Some(value);
116                }
117                "period" => {
118                    raw_period = Some(value);
119                }
120                "availableTime" => {
121                    raw_available_time = Some(value);
122                }
123                "notAvailableTime" => {
124                    raw_not_available_time = Some(value);
125                }
126                other => {
127                    return path.with(other, |path| {
128                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
129                    });
130                }
131            }
132        }
133        let field_id = raw_id
134            .map(|value| {
135                path.with("id", |path| {
136                    let value = super::super::codec::expect_single(value, path)?;
137                    super::primitives::checked_string(
138                        super::super::codec::expect_string(value, path)?,
139                        path,
140                    )
141                })
142            })
143            .transpose()?;
144        let mut field_extension = Vec::new();
145        if let Some(raw) = raw_extension {
146            for (index, value) in path
147                .with("extension", |path| {
148                    super::super::codec::expect_array(raw, path)
149                })?
150                .iter()
151                .enumerate()
152            {
153                field_extension.push(path.with_index("extension", index, |path| {
154                    super::super::codec::Json::from_json(
155                        super::super::codec::expect_object(value, path)?,
156                        path,
157                    )
158                })?);
159            }
160        }
161        let field_period = raw_period
162            .map(|value| {
163                path.with("period", |path| {
164                    super::super::codec::Json::from_json(
165                        super::super::codec::expect_object(
166                            super::super::codec::expect_single(value, path)?,
167                            path,
168                        )?,
169                        path,
170                    )
171                })
172            })
173            .transpose()?;
174        let mut field_available_time = Vec::new();
175        if let Some(raw) = raw_available_time {
176            for (index, value) in path
177                .with("availableTime", |path| {
178                    super::super::codec::expect_array(raw, path)
179                })?
180                .iter()
181                .enumerate()
182            {
183                field_available_time.push(path.with_index("availableTime", index, |path| {
184                    super::super::codec::Json::from_json(
185                        super::super::codec::expect_object(value, path)?,
186                        path,
187                    )
188                })?);
189            }
190        }
191        let mut field_not_available_time = Vec::new();
192        if let Some(raw) = raw_not_available_time {
193            for (index, value) in path
194                .with("notAvailableTime", |path| {
195                    super::super::codec::expect_array(raw, path)
196                })?
197                .iter()
198                .enumerate()
199            {
200                field_not_available_time.push(path.with_index(
201                    "notAvailableTime",
202                    index,
203                    |path| {
204                        super::super::codec::Json::from_json(
205                            super::super::codec::expect_object(value, path)?,
206                            path,
207                        )
208                    },
209                )?);
210            }
211        }
212        Ok(Self {
213            id: field_id,
214            extension: field_extension,
215            period: field_period,
216            available_time: field_available_time,
217            not_available_time: field_not_available_time,
218        })
219    }
220}
221
222impl serde::Serialize for Availability {
223    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
224        let mut map = serde::Serializer::serialize_map(serializer, None)?;
225        if !self.available_time.is_empty() {
226            serde::ser::SerializeMap::serialize_entry(
227                &mut map,
228                "availableTime",
229                &self.available_time,
230            )?;
231        }
232        if !self.extension.is_empty() {
233            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
234        }
235        if let Some(v) = &self.id {
236            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
237        }
238        if !self.not_available_time.is_empty() {
239            serde::ser::SerializeMap::serialize_entry(
240                &mut map,
241                "notAvailableTime",
242                &self.not_available_time,
243            )?;
244        }
245        if let Some(item) = &self.period {
246            serde::ser::SerializeMap::serialize_entry(&mut map, "period", item)?;
247        }
248        serde::ser::SerializeMap::end(map)
249    }
250}
251
252impl<'de> serde::Deserialize<'de> for Availability {
253    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
254        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
255        let mut path = super::super::codec::Path::root("Availability");
256        let object =
257            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
258        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
259    }
260}
261
262/// Times the {item} is available
263///
264/// A collection of times that the {item} is available.
265#[derive(Debug, Clone, Default, PartialEq, Eq)]
266pub struct AvailabilityAvailableTime {
267    /// Unique id for inter-element referencing
268    ///
269    /// Unique id for the element within a resource (for internal references). This
270    /// may be any string value that does not contain spaces.
271    pub id: Option<std::string::String>,
272    /// Additional content defined by implementations
273    ///
274    /// May be used to represent additional information that is not part of the
275    /// basic definition of the element. To make the use of extensions safe and
276    /// managable, there is a strict set of governance applied to the definition and
277    /// use of extensions. Though any implementer can define an extension, there is
278    /// a set of requirements that SHALL be met as part of the definition of the
279    /// extension.
280    pub extension: Vec<super::extension::Extension>,
281    /// mon | tue | wed | thu | fri | sat | sun
282    ///
283    /// Indicates which days of the week are available between the start and end
284    /// Times.
285    pub days_of_week: Vec<super::primitives::Code>,
286    /// Always available? i.e. 24 hour service
287    ///
288    /// Is this always available? (hence times are irrelevant) i.e. 24 hour service.
289    pub all_day: Option<super::primitives::Boolean>,
290    /// Opening time of day (ignored if allDay = true)
291    ///
292    /// The opening time of day. Note: If the AllDay flag is set, then this time is
293    /// ignored.
294    pub available_start_time: Option<super::primitives::Time>,
295    /// Closing time of day (ignored if allDay = true)
296    ///
297    /// The closing time of day. Note: If the AllDay flag is set, then this time is
298    /// ignored.
299    pub available_end_time: Option<super::primitives::Time>,
300}
301
302impl super::super::codec::Json for AvailabilityAvailableTime {
303    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
304        let mut object = super::super::codec::Object::new();
305        if let Some(v) = &self.id {
306            object.insert(
307                std::string::String::from("id"),
308                super::super::codec::Value::String(v.clone()),
309            );
310        }
311        if !self.extension.is_empty() {
312            let mut items = Vec::with_capacity(self.extension.len());
313            for item in &self.extension {
314                items.push(super::super::codec::Value::Object(
315                    super::super::codec::Json::to_json(item)?,
316                ));
317            }
318            object.insert(
319                std::string::String::from("extension"),
320                super::super::codec::Value::Array(items),
321            );
322        }
323        if !self.days_of_week.is_empty() {
324            let (values, elements) = super::super::codec::primitive_arrays(&self.days_of_week)?;
325            if let Some(values) = values {
326                object.insert(std::string::String::from("daysOfWeek"), values);
327            }
328            if let Some(elements) = elements {
329                object.insert(std::string::String::from("_daysOfWeek"), elements);
330            }
331        }
332        if let Some(item) = &self.all_day {
333            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
334                object.insert(std::string::String::from("allDay"), v);
335            }
336            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
337                object.insert(std::string::String::from("_allDay"), e);
338            }
339        }
340        if let Some(item) = &self.available_start_time {
341            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
342                object.insert(std::string::String::from("availableStartTime"), v);
343            }
344            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
345                object.insert(std::string::String::from("_availableStartTime"), e);
346            }
347        }
348        if let Some(item) = &self.available_end_time {
349            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
350                object.insert(std::string::String::from("availableEndTime"), v);
351            }
352            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
353                object.insert(std::string::String::from("_availableEndTime"), e);
354            }
355        }
356        Ok(object)
357    }
358
359    fn from_json(
360        object: &super::super::codec::Object,
361        path: &mut super::super::codec::Path,
362    ) -> Result<Self, super::super::codec::DecodeError> {
363        let mut raw_id: Option<&super::super::codec::Value> = None;
364        let mut raw_extension: Option<&super::super::codec::Value> = None;
365        let mut raw_days_of_week: Option<&super::super::codec::Value> = None;
366        let mut raw_days_of_week_element: Option<&super::super::codec::Value> = None;
367        let mut raw_all_day: Option<&super::super::codec::Value> = None;
368        let mut raw_all_day_element: Option<&super::super::codec::Value> = None;
369        let mut raw_available_start_time: Option<&super::super::codec::Value> = None;
370        let mut raw_available_start_time_element: Option<&super::super::codec::Value> = None;
371        let mut raw_available_end_time: Option<&super::super::codec::Value> = None;
372        let mut raw_available_end_time_element: Option<&super::super::codec::Value> = None;
373        for (key, value) in object {
374            match key.as_str() {
375                "id" => {
376                    raw_id = Some(value);
377                }
378                "extension" => {
379                    raw_extension = Some(value);
380                }
381                "daysOfWeek" => {
382                    raw_days_of_week = Some(value);
383                }
384                "_daysOfWeek" => {
385                    raw_days_of_week_element = Some(value);
386                }
387                "allDay" => {
388                    raw_all_day = Some(value);
389                }
390                "_allDay" => {
391                    raw_all_day_element = Some(value);
392                }
393                "availableStartTime" => {
394                    raw_available_start_time = Some(value);
395                }
396                "_availableStartTime" => {
397                    raw_available_start_time_element = Some(value);
398                }
399                "availableEndTime" => {
400                    raw_available_end_time = Some(value);
401                }
402                "_availableEndTime" => {
403                    raw_available_end_time_element = Some(value);
404                }
405                other => {
406                    return path.with(other, |path| {
407                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
408                    });
409                }
410            }
411        }
412        let field_id = raw_id
413            .map(|value| {
414                path.with("id", |path| {
415                    let value = super::super::codec::expect_single(value, path)?;
416                    super::primitives::checked_string(
417                        super::super::codec::expect_string(value, path)?,
418                        path,
419                    )
420                })
421            })
422            .transpose()?;
423        let mut field_extension = Vec::new();
424        if let Some(raw) = raw_extension {
425            for (index, value) in path
426                .with("extension", |path| {
427                    super::super::codec::expect_array(raw, path)
428                })?
429                .iter()
430                .enumerate()
431            {
432                field_extension.push(path.with_index("extension", index, |path| {
433                    super::super::codec::Json::from_json(
434                        super::super::codec::expect_object(value, path)?,
435                        path,
436                    )
437                })?);
438            }
439        }
440        let mut field_days_of_week = Vec::new();
441        for (index, (value, element)) in path
442            .with("daysOfWeek", |path| {
443                super::super::codec::pair_arrays(raw_days_of_week, raw_days_of_week_element, path)
444            })?
445            .into_iter()
446            .enumerate()
447        {
448            field_days_of_week.push(path.with_index("daysOfWeek", index, |path| {
449                super::super::codec::Primitive::from_json_parts(value, element, path)
450            })?);
451        }
452        let field_all_day = match (raw_all_day, raw_all_day_element) {
453            (None, None) => None,
454            (value, element) => Some(path.with("allDay", |path| {
455                super::super::codec::Primitive::from_json_parts(value, element, path)
456            })?),
457        };
458        let field_available_start_time =
459            match (raw_available_start_time, raw_available_start_time_element) {
460                (None, None) => None,
461                (value, element) => Some(path.with("availableStartTime", |path| {
462                    super::super::codec::Primitive::from_json_parts(value, element, path)
463                })?),
464            };
465        let field_available_end_time =
466            match (raw_available_end_time, raw_available_end_time_element) {
467                (None, None) => None,
468                (value, element) => Some(path.with("availableEndTime", |path| {
469                    super::super::codec::Primitive::from_json_parts(value, element, path)
470                })?),
471            };
472        Ok(Self {
473            id: field_id,
474            extension: field_extension,
475            days_of_week: field_days_of_week,
476            all_day: field_all_day,
477            available_start_time: field_available_start_time,
478            available_end_time: field_available_end_time,
479        })
480    }
481}
482
483impl serde::Serialize for AvailabilityAvailableTime {
484    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
485        let mut map = serde::Serializer::serialize_map(serializer, None)?;
486        if let Some(item) = &self.all_day {
487            super::super::codec::element_entry(&mut map, "_allDay", item)?;
488        }
489        if let Some(item) = &self.available_end_time {
490            super::super::codec::element_entry(&mut map, "_availableEndTime", item)?;
491        }
492        if let Some(item) = &self.available_start_time {
493            super::super::codec::element_entry(&mut map, "_availableStartTime", item)?;
494        }
495        super::super::codec::element_list_entry(&mut map, "_daysOfWeek", &self.days_of_week)?;
496        if let Some(item) = &self.all_day {
497            super::super::codec::value_entry(&mut map, "allDay", item)?;
498        }
499        if let Some(item) = &self.available_end_time {
500            super::super::codec::value_entry(&mut map, "availableEndTime", item)?;
501        }
502        if let Some(item) = &self.available_start_time {
503            super::super::codec::value_entry(&mut map, "availableStartTime", item)?;
504        }
505        super::super::codec::value_list_entry(&mut map, "daysOfWeek", &self.days_of_week)?;
506        if !self.extension.is_empty() {
507            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
508        }
509        if let Some(v) = &self.id {
510            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
511        }
512        serde::ser::SerializeMap::end(map)
513    }
514}
515
516impl<'de> serde::Deserialize<'de> for AvailabilityAvailableTime {
517    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
518        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
519        let mut path = super::super::codec::Path::root("AvailabilityAvailableTime");
520        let object =
521            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
522        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
523    }
524}
525
526/// Not available during this time due to provided reason
527///
528/// The {item} is not available during this period of time due to the provided
529/// reason.
530#[derive(Debug, Clone, Default, PartialEq, Eq)]
531pub struct AvailabilityNotAvailableTime {
532    /// Unique id for inter-element referencing
533    ///
534    /// Unique id for the element within a resource (for internal references). This
535    /// may be any string value that does not contain spaces.
536    pub id: Option<std::string::String>,
537    /// Additional content defined by implementations
538    ///
539    /// May be used to represent additional information that is not part of the
540    /// basic definition of the element. To make the use of extensions safe and
541    /// managable, there is a strict set of governance applied to the definition and
542    /// use of extensions. Though any implementer can define an extension, there is
543    /// a set of requirements that SHALL be met as part of the definition of the
544    /// extension.
545    pub extension: Vec<super::extension::Extension>,
546    /// Reason presented to the user explaining why time not available
547    ///
548    /// The reason that can be presented to the user as to why this time is not
549    /// available.
550    pub description: Option<super::primitives::String>,
551    /// Service not available during this period
552    ///
553    /// The {item} is not available (seasonally or for a public holiday) during this
554    /// period.
555    pub during: Option<super::period::Period>,
556}
557
558impl super::super::codec::Json for AvailabilityNotAvailableTime {
559    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
560        let mut object = super::super::codec::Object::new();
561        if let Some(v) = &self.id {
562            object.insert(
563                std::string::String::from("id"),
564                super::super::codec::Value::String(v.clone()),
565            );
566        }
567        if !self.extension.is_empty() {
568            let mut items = Vec::with_capacity(self.extension.len());
569            for item in &self.extension {
570                items.push(super::super::codec::Value::Object(
571                    super::super::codec::Json::to_json(item)?,
572                ));
573            }
574            object.insert(
575                std::string::String::from("extension"),
576                super::super::codec::Value::Array(items),
577            );
578        }
579        if let Some(item) = &self.description {
580            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
581                object.insert(std::string::String::from("description"), v);
582            }
583            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
584                object.insert(std::string::String::from("_description"), e);
585            }
586        }
587        if let Some(item) = &self.during {
588            object.insert(
589                std::string::String::from("during"),
590                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
591            );
592        }
593        Ok(object)
594    }
595
596    fn from_json(
597        object: &super::super::codec::Object,
598        path: &mut super::super::codec::Path,
599    ) -> Result<Self, super::super::codec::DecodeError> {
600        let mut raw_id: Option<&super::super::codec::Value> = None;
601        let mut raw_extension: Option<&super::super::codec::Value> = None;
602        let mut raw_description: Option<&super::super::codec::Value> = None;
603        let mut raw_description_element: Option<&super::super::codec::Value> = None;
604        let mut raw_during: Option<&super::super::codec::Value> = None;
605        for (key, value) in object {
606            match key.as_str() {
607                "id" => {
608                    raw_id = Some(value);
609                }
610                "extension" => {
611                    raw_extension = Some(value);
612                }
613                "description" => {
614                    raw_description = Some(value);
615                }
616                "_description" => {
617                    raw_description_element = Some(value);
618                }
619                "during" => {
620                    raw_during = Some(value);
621                }
622                other => {
623                    return path.with(other, |path| {
624                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
625                    });
626                }
627            }
628        }
629        let field_id = raw_id
630            .map(|value| {
631                path.with("id", |path| {
632                    let value = super::super::codec::expect_single(value, path)?;
633                    super::primitives::checked_string(
634                        super::super::codec::expect_string(value, path)?,
635                        path,
636                    )
637                })
638            })
639            .transpose()?;
640        let mut field_extension = Vec::new();
641        if let Some(raw) = raw_extension {
642            for (index, value) in path
643                .with("extension", |path| {
644                    super::super::codec::expect_array(raw, path)
645                })?
646                .iter()
647                .enumerate()
648            {
649                field_extension.push(path.with_index("extension", index, |path| {
650                    super::super::codec::Json::from_json(
651                        super::super::codec::expect_object(value, path)?,
652                        path,
653                    )
654                })?);
655            }
656        }
657        let field_description = match (raw_description, raw_description_element) {
658            (None, None) => None,
659            (value, element) => Some(path.with("description", |path| {
660                super::super::codec::Primitive::from_json_parts(value, element, path)
661            })?),
662        };
663        let field_during = raw_during
664            .map(|value| {
665                path.with("during", |path| {
666                    super::super::codec::Json::from_json(
667                        super::super::codec::expect_object(
668                            super::super::codec::expect_single(value, path)?,
669                            path,
670                        )?,
671                        path,
672                    )
673                })
674            })
675            .transpose()?;
676        Ok(Self {
677            id: field_id,
678            extension: field_extension,
679            description: field_description,
680            during: field_during,
681        })
682    }
683}
684
685impl serde::Serialize for AvailabilityNotAvailableTime {
686    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
687        let mut map = serde::Serializer::serialize_map(serializer, None)?;
688        if let Some(item) = &self.description {
689            super::super::codec::element_entry(&mut map, "_description", item)?;
690        }
691        if let Some(item) = &self.description {
692            super::super::codec::value_entry(&mut map, "description", item)?;
693        }
694        if let Some(item) = &self.during {
695            serde::ser::SerializeMap::serialize_entry(&mut map, "during", item)?;
696        }
697        if !self.extension.is_empty() {
698            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
699        }
700        if let Some(v) = &self.id {
701            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
702        }
703        serde::ser::SerializeMap::end(map)
704    }
705}
706
707impl<'de> serde::Deserialize<'de> for AvailabilityNotAvailableTime {
708    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
709        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
710        let mut path = super::super::codec::Path::root("AvailabilityNotAvailableTime");
711        let object =
712            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
713        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
714    }
715}