/*
 * 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 InstanceModel {
    #[serde(rename = "fid")]
    pub fid: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "project")]
    pub project: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "created_by")]
    pub created_by: String,
    #[serde(rename = "instance_type")]
    pub instance_type: String,
    #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    #[serde(rename = "bid", skip_serializing_if = "Option::is_none")]
    pub bid: Option<String>,
    #[serde(rename = "reservation", skip_serializing_if = "Option::is_none")]
    pub reservation: Option<String>,
    #[serde(rename = "ssh_destination", skip_serializing_if = "Option::is_none")]
    pub ssh_destination: Option<String>,
    #[serde(rename = "private_ip", skip_serializing_if = "Option::is_none")]
    pub private_ip: Option<String>,
    #[serde(rename = "status")]
    pub status: Status,
}

impl InstanceModel {
    pub fn new(
        fid: String,
        name: String,
        project: String,
        created_at: String,
        created_by: String,
        instance_type: String,
        status: Status,
    ) -> InstanceModel {
        InstanceModel {
            fid,
            name,
            project,
            created_at,
            created_by,
            instance_type,
            region: None,
            bid: None,
            reservation: None,
            ssh_destination: None,
            private_ip: None,
            status,
        }
    }
}
///
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum Status {
    #[serde(rename = "STATUS_NEW")]
    #[default]
    StatusNew,
    #[serde(rename = "STATUS_CONFIRMED")]
    StatusConfirmed,
    #[serde(rename = "STATUS_SCHEDULED")]
    StatusScheduled,
    #[serde(rename = "STATUS_INITIALIZING")]
    StatusInitializing,
    #[serde(rename = "STATUS_STARTING")]
    StatusStarting,
    #[serde(rename = "STATUS_RUNNING")]
    StatusRunning,
    #[serde(rename = "STATUS_STOPPING")]
    StatusStopping,
    #[serde(rename = "STATUS_STOPPED")]
    StatusStopped,
    #[serde(rename = "STATUS_TERMINATED")]
    StatusTerminated,
    #[serde(rename = "STATUS_RELOCATING")]
    StatusRelocating,
    #[serde(rename = "STATUS_PREEMPTING")]
    StatusPreempting,
    #[serde(rename = "STATUS_PREEMPTED")]
    StatusPreempted,
    #[serde(rename = "STATUS_REPLACED")]
    StatusReplaced,
    #[serde(rename = "STATUS_PAUSED")]
    StatusPaused,
    #[serde(rename = "STATUS_ERROR")]
    StatusError,
}
