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

/// StorageBoxType : Type of the Storage Box.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct StorageBoxType {
    /// Maximum number of snapshots created automatically by a snapshot plan.
    #[serde(
        rename = "automatic_snapshot_limit",
        deserialize_with = "Option::deserialize"
    )]
    pub automatic_snapshot_limit: Option<i32>,
    /// 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>>,
    /// Description of the Storage Box Type.
    #[serde(rename = "description")]
    pub description: String,
    /// ID of the Storage Box Type.
    #[serde(rename = "id")]
    pub id: i64,
    /// Name of the Storage Box Type.
    #[serde(rename = "name")]
    pub name: String,
    /// Price per Location.
    #[serde(rename = "prices")]
    pub prices: Vec<models::StorageBoxTypePricesInner>,
    /// Available storage in bytes.
    #[serde(rename = "size")]
    pub size: i64,
    /// Maximum number of allowed manual snapshots.
    #[serde(rename = "snapshot_limit", deserialize_with = "Option::deserialize")]
    pub snapshot_limit: Option<i32>,
    /// Maximum number of subaccounts.
    #[serde(rename = "subaccounts_limit")]
    pub subaccounts_limit: i32,
}

impl StorageBoxType {
    /// Type of the Storage Box.
    pub fn new(
        automatic_snapshot_limit: Option<i32>,
        deprecation: Option<models::DeprecationInfo>,
        description: String,
        id: i64,
        name: String,
        prices: Vec<models::StorageBoxTypePricesInner>,
        size: i64,
        snapshot_limit: Option<i32>,
        subaccounts_limit: i32,
    ) -> StorageBoxType {
        StorageBoxType {
            automatic_snapshot_limit,
            deprecation: deprecation.map(Box::new),
            description,
            id,
            name,
            prices,
            size,
            snapshot_limit,
            subaccounts_limit,
        }
    }
}
