/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// XApiOperation : A single X API operation with its per-call price and the Zernio platform methods that trigger it.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct XApiOperation {
    /// Internal operation key. Matches keys in `xApiCallsByOperation`.
    #[serde(rename = "operation", skip_serializing_if = "Option::is_none")]
    pub operation: Option<String>,
    /// Metronome `event_type` emitted when this operation runs.
    #[serde(rename = "eventType", skip_serializing_if = "Option::is_none")]
    pub event_type: Option<String>,
    /// Human-readable label shown on Metronome invoices.
    #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
    pub display_name: Option<String>,
    #[serde(rename = "pricePerCallUsd", skip_serializing_if = "Option::is_none")]
    pub price_per_call_usd: Option<f64>,
    /// Per-call price in cents. Fractional values are intentional.
    #[serde(rename = "pricePerCallCents", skip_serializing_if = "Option::is_none")]
    pub price_per_call_cents: Option<f64>,
    /// Tier key derived from `pricePerCallUsd` (e.g. `x_api_005` for $0.005, `x_api_200` for $0.200). Useful for grouping operations by price in dashboards.
    #[serde(rename = "tier", skip_serializing_if = "Option::is_none")]
    pub tier: Option<String>,
    /// Zernio platform methods that emit this operation, with their metering rule.
    #[serde(rename = "triggeredBy", skip_serializing_if = "Option::is_none")]
    pub triggered_by: Option<Vec<models::XApiOperationTriggeredByInner>>,
}

impl XApiOperation {
    /// A single X API operation with its per-call price and the Zernio platform methods that trigger it.
    pub fn new() -> XApiOperation {
        XApiOperation {
            operation: None,
            event_type: None,
            display_name: None,
            price_per_call_usd: None,
            price_per_call_cents: None,
            tier: None,
            triggered_by: None,
        }
    }
}
