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};

/// SubdivisionResponse : Representation of a subdivision
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SubdivisionResponse {
    /// Localized categories of the subdivision
    #[serde(rename = "category")]
    pub category: Vec<models::LocalizedText>,
    /// Child subdivisions
    #[serde(rename = "children", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub children: Option<Option<Vec<models::SubdivisionResponse>>>,
    /// Subdivision code
    #[serde(rename = "code")]
    pub code: String,
    /// Localized comments of the subdivision
    #[serde(rename = "comment", skip_serializing_if = "Option::is_none")]
    pub comment: Option<Vec<models::LocalizedText>>,
    /// ISO 3166-2 subdivision code (if defined)
    #[serde(rename = "isoCode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub iso_code: Option<Option<String>>,
    /// Localized names of the subdivision
    #[serde(rename = "name")]
    pub name: Vec<models::LocalizedText>,
    /// Official languages as ISO-639-1 codes
    #[serde(rename = "officialLanguages")]
    pub official_languages: Vec<String>,
    /// Short name for display
    #[serde(rename = "shortName")]
    pub short_name: String,
}

impl SubdivisionResponse {
    /// Representation of a subdivision
    pub fn new(category: Vec<models::LocalizedText>, code: String, name: Vec<models::LocalizedText>, official_languages: Vec<String>, short_name: String) -> SubdivisionResponse {
        SubdivisionResponse {
            category,
            children: None,
            code,
            comment: None,
            iso_code: None,
            name,
            official_languages,
            short_name,
        }
    }
}