/*
 * API Documentation
 *
 * Source of truth and network automation platform
 *
 * The version of the OpenAPI document: 3.1.0 (3.1)
 *
 * Generated by: https://openapi-generator.tech
 */

/// Rack : Base class to use for serializers based on OrganizationalModel or PrimaryModel.  Can also be used for models derived from BaseModel, so long as they support custom fields, notes, and relationships.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Rack {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<uuid::Uuid>,
    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
    pub object_type: Option<String>,
    /// Human friendly display value
    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
    pub display: Option<String>,
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
    pub natural_slug: Option<String>,
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Box<crate::models::RackType>>,
    #[serde(rename = "width", skip_serializing_if = "Option::is_none")]
    pub width: Option<Box<crate::models::RackWidth>>,
    #[serde(rename = "outer_unit", skip_serializing_if = "Option::is_none")]
    pub outer_unit: Option<Box<crate::models::RackOuterUnit>>,
    #[serde(rename = "device_count", skip_serializing_if = "Option::is_none")]
    pub device_count: Option<i32>,
    #[serde(rename = "power_feed_count", skip_serializing_if = "Option::is_none")]
    pub power_feed_count: Option<i32>,
    #[serde(rename = "name")]
    pub name: String,
    /// Locally-assigned identifier
    #[serde(
        rename = "facility_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub facility_id: Option<Option<String>>,
    #[serde(rename = "serial", skip_serializing_if = "Option::is_none")]
    pub serial: Option<String>,
    /// A unique tag used to identify this rack
    #[serde(
        rename = "asset_tag",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub asset_tag: Option<Option<String>>,
    /// Height in rack units
    #[serde(rename = "u_height", skip_serializing_if = "Option::is_none")]
    pub u_height: Option<i32>,
    /// Units are numbered top-to-bottom
    #[serde(rename = "desc_units", skip_serializing_if = "Option::is_none")]
    pub desc_units: Option<bool>,
    /// Outer dimension of rack (width)
    #[serde(
        rename = "outer_width",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub outer_width: Option<Option<i32>>,
    /// Outer dimension of rack (depth)
    #[serde(
        rename = "outer_depth",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub outer_depth: Option<Option<i32>>,
    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
    pub comments: Option<String>,
    #[serde(rename = "status")]
    pub status: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
    #[serde(
        rename = "role",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub role: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
    #[serde(rename = "location")]
    pub location: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
    #[serde(
        rename = "rack_group",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub rack_group: Option<Option<Box<crate::models::BulkWritableRackRequestRackGroup>>>,
    #[serde(
        rename = "tenant",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub tenant: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
    #[serde(
        rename = "created",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub created: Option<Option<String>>,
    #[serde(
        rename = "last_updated",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_updated: Option<Option<String>>,
    #[serde(rename = "notes_url", skip_serializing_if = "Option::is_none")]
    pub notes_url: Option<String>,
    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>>,
}

impl Rack {
    /// Base class to use for serializers based on OrganizationalModel or PrimaryModel.  Can also be used for models derived from BaseModel, so long as they support custom fields, notes, and relationships.
    pub fn new(
        name: String,
        status: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
        location: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
    ) -> Rack {
        Rack {
            id: None,
            object_type: None,
            display: None,
            url: None,
            natural_slug: None,
            r#type: None,
            width: None,
            outer_unit: None,
            device_count: None,
            power_feed_count: None,
            name,
            facility_id: None,
            serial: None,
            asset_tag: None,
            u_height: None,
            desc_units: None,
            outer_width: None,
            outer_depth: None,
            comments: None,
            status: Box::new(status),
            role: None,
            location: Box::new(location),
            rack_group: None,
            tenant: None,
            created: None,
            last_updated: None,
            notes_url: None,
            custom_fields: None,
            tags: None,
        }
    }
}
