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

/// GetAvailabilityResponse : Unified response for availability queries.  - mode='slots': slots field contains list of availability slots - mode='latest_end_time': latest_end_time and available fields are set - mode='check': only available field is set
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetAvailabilityResponse {
    #[serde(rename = "mode")]
    pub mode: Mode,
    #[serde(rename = "slots", skip_serializing_if = "Option::is_none")]
    pub slots: Option<Vec<models::AvailabilitySlotModel>>,
    #[serde(rename = "latest_end_time", skip_serializing_if = "Option::is_none")]
    pub latest_end_time: Option<String>,
    #[serde(rename = "available", skip_serializing_if = "Option::is_none")]
    pub available: Option<bool>,
}

impl GetAvailabilityResponse {
    /// Unified response for availability queries.  - mode='slots': slots field contains list of availability slots - mode='latest_end_time': latest_end_time and available fields are set - mode='check': only available field is set
    pub fn new(mode: Mode) -> GetAvailabilityResponse {
        GetAvailabilityResponse {
            mode,
            slots: None,
            latest_end_time: None,
            available: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Mode {
    #[serde(rename = "slots")]
    Slots,
    #[serde(rename = "latest_end_time")]
    LatestEndTime,
    #[serde(rename = "check")]
    Check,
}

impl Default for Mode {
    fn default() -> Mode {
        Self::Slots
    }
}

