/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 4b3f595
 *
 * Generated by: https://openapi-generator.tech
 */

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

/// ServerTypeLocation : A Location (containing only id and name) and Server Type specific metadata.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ServerTypeLocation {
    /// Describes if, when and how the resource is deprecated. If this field is set to `null` the resource is not deprecated. If a value is set, it is considered deprecated.
    #[serde(rename = "deprecation", deserialize_with = "Option::deserialize")]
    pub deprecation: Option<Box<models::DeprecationInfo>>,
    /// ID of the Location.
    #[serde(rename = "id")]
    pub id: i64,
    /// Name of the Location.
    #[serde(rename = "name")]
    pub name: String,
}

impl ServerTypeLocation {
    /// A Location (containing only id and name) and Server Type specific metadata.
    pub fn new(
        deprecation: Option<models::DeprecationInfo>,
        id: i64,
        name: String,
    ) -> ServerTypeLocation {
        ServerTypeLocation {
            deprecation: deprecation.map(Box::new),
            id,
            name,
        }
    }
}
