/*
 * 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 AuctionModel {
    #[serde(rename = "fid")]
    pub fid: String,
    #[serde(rename = "instance_type")]
    pub instance_type: String,
    #[serde(rename = "region")]
    pub region: String,
    #[serde(rename = "capacity")]
    pub capacity: i32,
    #[serde(rename = "last_instance_price")]
    pub last_instance_price: String,
    #[serde(
        rename = "lowest_allocated_price",
        skip_serializing_if = "Option::is_none"
    )]
    pub lowest_allocated_price: Option<String>,
    #[serde(rename = "adjustable_memory")]
    pub adjustable_memory: bool,
    #[serde(
        rename = "default_image_version",
        skip_serializing_if = "Option::is_none"
    )]
    pub default_image_version: Option<String>,
}

impl AuctionModel {
    pub fn new(
        fid: String,
        instance_type: String,
        region: String,
        capacity: i32,
        last_instance_price: String,
        adjustable_memory: bool,
    ) -> AuctionModel {
        AuctionModel {
            fid,
            instance_type,
            region,
            capacity,
            last_instance_price,
            lowest_allocated_price: None,
            adjustable_memory,
            default_image_version: None,
        }
    }
}
