siapla-open-holidays-api 0.2.1

A simple agile planning tool
Documentation
/*
 * OpenHolidays API v1
 *
 * Open Data API for public and school holidays
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// HolidayResponse : Representation of a holiday
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct HolidayResponse {
    /// Additional localized comments
    #[serde(rename = "comment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub comment: Option<Option<Vec<models::LocalizedText>>>,
    /// End date of the holiday
    #[serde(rename = "endDate")]
    pub end_date: chrono::NaiveDate,
    /// Unqiue holiday id
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Localized names of the holiday
    #[serde(rename = "name")]
    pub name: Vec<models::LocalizedText>,
    /// Is the holiday nationwide?
    #[serde(rename = "nationwide")]
    pub nationwide: bool,
    #[serde(rename = "regionalScope", skip_serializing_if = "Option::is_none")]
    pub regional_scope: Option<models::RegionalScope>,
    /// Start date of the holiday
    #[serde(rename = "startDate")]
    pub start_date: chrono::NaiveDate,
    /// List of subdivision references
    #[serde(rename = "subdivisions", skip_serializing_if = "Option::is_none")]
    pub subdivisions: Option<Vec<models::SubdivisionReference>>,
    #[serde(rename = "temporalScope", skip_serializing_if = "Option::is_none")]
    pub temporal_scope: Option<models::TemporalScope>,
    #[serde(rename = "type")]
    pub r#type: models::HolidayType,
}

impl HolidayResponse {
    /// Representation of a holiday
    pub fn new(end_date: chrono::NaiveDate, id: uuid::Uuid, name: Vec<models::LocalizedText>, nationwide: bool, start_date: chrono::NaiveDate, r#type: models::HolidayType) -> HolidayResponse {
        HolidayResponse {
            comment: None,
            end_date,
            id,
            name,
            nationwide,
            regional_scope: None,
            start_date,
            subdivisions: None,
            temporal_scope: None,
            r#type,
        }
    }
}