/*
 * Mithril
 *
 * Mithril Compute API
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReservationModel {
    #[serde(rename = "fid")]
    pub fid: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "project")]
    pub project: String,
    #[serde(rename = "created_by")]
    pub created_by: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "deactivated_at", skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<String>,
    #[serde(rename = "instance_quantity")]
    pub instance_quantity: i32,
    #[serde(rename = "instance_type")]
    pub instance_type: String,
    #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    #[serde(rename = "instances")]
    pub instances: Vec<String>,
    #[serde(rename = "launch_specification")]
    pub launch_specification: Box<models::LaunchSpecificationModel>,
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "start_time")]
    pub start_time: String,
    #[serde(rename = "end_time")]
    pub end_time: String,
    #[serde(rename = "total_price")]
    pub total_price: String,
    #[serde(rename = "unit_price")]
    pub unit_price: String,
}

impl ReservationModel {
    pub fn new(
        fid: String,
        name: String,
        project: String,
        created_by: String,
        created_at: String,
        instance_quantity: i32,
        instance_type: String,
        instances: Vec<String>,
        launch_specification: models::LaunchSpecificationModel,
        status: Status,
        start_time: String,
        end_time: String,
        total_price: String,
        unit_price: String,
    ) -> ReservationModel {
        ReservationModel {
            fid,
            name,
            project,
            created_by,
            created_at,
            deactivated_at: None,
            instance_quantity,
            instance_type,
            region: None,
            instances,
            launch_specification: Box::new(launch_specification),
            status,
            start_time,
            end_time,
            total_price,
            unit_price,
        }
    }
}
///
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum Status {
    #[serde(rename = "Pending")]
    #[default]
    Pending,
    #[serde(rename = "Active")]
    Active,
    #[serde(rename = "Paused")]
    Paused,
    #[serde(rename = "Canceled")]
    Canceled,
    #[serde(rename = "Ended")]
    Ended,
}
