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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PlacementGroup {
    /// Point in time when the Resource was created (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format).
    #[serde(rename = "created")]
    pub created: String,
    /// ID of the Placement Group.
    #[serde(rename = "id")]
    pub id: i64,
    /// User-defined labels (`key/value` pairs) for the Resource. For more information, see \"Labels\".  | User-defined labels (`key/value` pairs) for the Resource.  Note that the set of Labels provided in the request will overwrite the existing one.  For more information, see \"Labels\".
    #[serde(rename = "labels")]
    pub labels: std::collections::HashMap<String, String>,
    /// Name of the Resource. Must be unique per Project.
    #[serde(rename = "name")]
    pub name: String,
    /// Array of IDs of Servers that are part of this Placement Group.
    #[serde(rename = "servers")]
    pub servers: Vec<i64>,
    /// Type of Placement Group.
    #[serde(rename = "type")]
    pub r#type: Type,
}

impl PlacementGroup {
    pub fn new(
        created: String,
        id: i64,
        labels: std::collections::HashMap<String, String>,
        name: String,
        servers: Vec<i64>,
        r#type: Type,
    ) -> PlacementGroup {
        PlacementGroup {
            created,
            id,
            labels,
            name,
            servers,
            r#type,
        }
    }
}
/// Type of Placement Group.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "spread")]
    Spread,
}

impl Default for Type {
    fn default() -> Type {
        Self::Spread
    }
}
