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

/// QuotaModel : Unified quota model for all quota types (instances, storage, Kubernetes).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct QuotaModel {
    /// Unique identifier for the quota
    #[serde(rename = "fid")]
    pub fid: String,
    /// Project FID this quota belongs to
    #[serde(rename = "project")]
    pub project: String,
    #[serde(rename = "instance_type", skip_serializing_if = "Option::is_none")]
    pub instance_type: Option<String>,
    /// Type of product (e.g., 'Spot', 'Reservations', 'Storage')
    #[serde(rename = "product_type")]
    pub product_type: String,
    /// Total quota quantity used
    #[serde(rename = "total_quantity")]
    pub total_quantity: i32,
    /// Total quota quantity used
    #[serde(rename = "used_quantity")]
    pub used_quantity: i32,
    /// Units for the quota (e.g., 'instances', 'GB')
    #[serde(rename = "units")]
    pub units: String,
    /// Human-readable display name for the quota
    #[serde(rename = "name")]
    pub name: String,
}

impl QuotaModel {
    /// Unified quota model for all quota types (instances, storage, Kubernetes).
    pub fn new(
        fid: String,
        project: String,
        product_type: String,
        total_quantity: i32,
        used_quantity: i32,
        units: String,
        name: String,
    ) -> QuotaModel {
        QuotaModel {
            fid,
            project,
            instance_type: None,
            product_type,
            total_quantity,
            used_quantity,
            units,
            name,
        }
    }
}
