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

/// BidHistoryEventModel : A single event in the history of a spot bid.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BidHistoryEventModel {
    /// When the event occurred
    #[serde(rename = "timestamp")]
    pub timestamp: String,
    #[serde(rename = "event_type")]
    pub event_type: EventType,
    #[serde(rename = "limit_price", skip_serializing_if = "Option::is_none")]
    pub limit_price: Option<String>,
    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    #[serde(rename = "memory_gb", skip_serializing_if = "Option::is_none")]
    pub memory_gb: Option<i32>,
    #[serde(
        rename = "persistent_disk_change",
        skip_serializing_if = "Option::is_none"
    )]
    pub persistent_disk_change: Option<Box<models::PersistentDiskChange>>,
}

impl BidHistoryEventModel {
    /// A single event in the history of a spot bid.
    pub fn new(timestamp: String, event_type: EventType) -> BidHistoryEventModel {
        BidHistoryEventModel {
            timestamp,
            event_type,
            limit_price: None,
            user_id: None,
            memory_gb: None,
            persistent_disk_change: None,
        }
    }
}
///
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum EventType {
    #[serde(rename = "Placed")]
    #[default]
    Placed,
    #[serde(rename = "Paused")]
    Paused,
    #[serde(rename = "Resumed")]
    Resumed,
    #[serde(rename = "Terminated")]
    Terminated,
    #[serde(rename = "Allocated")]
    Allocated,
    #[serde(rename = "Preempted")]
    Preempted,
    #[serde(rename = "Limit Price Changed")]
    LimitPriceChanged,
    #[serde(rename = "Memory Adjusted")]
    MemoryAdjusted,
    #[serde(rename = "Volumes Attached")]
    VolumesAttached,
    #[serde(rename = "Volumes Removed")]
    VolumesRemoved,
}
