libtad_models/holidays/
holiday.rs

1use super::HolidayState;
2use crate::{places::Country, time::Time, Text};
3use serde::Deserialize;
4
5#[derive(Debug, Deserialize)]
6/// A holiday event.
7pub struct Holiday {
8    /// Identifier for the holiday definition. Please note that this id
9    /// is not unique, not even with a single year - the same holiday
10    /// event may be returned multiple times because it is observed on a
11    /// different day, or because it is scheduled in a different calendar
12    /// (Hebrew or Muslim calendar) and happens multiple times within a
13    /// Gregorian year. Use the uid attribute for purposes where you need a
14    /// unique identifier.
15    pub id: i32,
16
17    /// Id for the shown holiday instance. The id is designed to be unique
18    /// across all holiday instances generated by the timeanddate.com API
19    /// services and respects different calendars and other reasons that
20    /// may cause events to occur multiple times within one Gregorian year.
21    pub uid: String,
22
23    /// List of holiday/observance names.
24    pub name: Vec<Text>,
25
26    /// Date/time of the holiday instance. Most holidays do not have a specific
27    /// time - in this case the time components will be skipped. Some
28    /// special events like equinoxes and solstices include the exact time
29    /// of the event as well, in this case the timestamp will be in local
30    /// time zone (including time zone data) (countries with multiple
31    /// timezones: local time in capital city).
32    pub date: Time,
33
34    /// Further information about the specific holiday. The Url points to
35    /// the timeanddate.com web page.
36    ///
37    /// Example: <https://www.timeanddate.com/holidays/us/new-year-day>
38    pub url: url::Url,
39
40    /// Country of the holiday instance.
41    pub country: Option<Country>,
42
43    /// Summary of locations where this holiday instance is valid. Element is
44    /// only present if the holiday instance does not affect the whole country.
45    pub locations: Option<String>,
46
47    /// States/subdivisions that are affected by this holiday instance. This
48    /// element is only present if the holiday instance is not valid in the
49    /// whole country.
50    pub states: Option<Vec<HolidayState>>,
51
52    /// List of holiday/observance descriptions.
53    pub oneliner: Option<Vec<Text>>,
54
55    /// Classification of the holiday. Most days have only one classification,
56    /// but some have multiple types associated. This happens e.g. in
57    /// conjunction with religious days that also are flag days.
58    ///
59    /// Example: National Holiday
60    pub types: Option<Vec<String>>,
61}