/*
 * Cube.js
 *
 * Cube.js Swagger Schema
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

/// V1CubeMetaFormatDescription : Resolved format description with the predefined name and d3-format specifier
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V1CubeMetaFormatDescription {
    /// Predefined format name (e.g., 'percent_2', 'currency_1') or a base name like 'number', or 'custom' for ad-hoc specifiers
    #[serde(rename = "name")]
    pub name: String,
    /// d3-format specifier string (e.g., '.2f', ',.0f', '$,.2f'). See https://d3js.org/d3-format
    #[serde(rename = "specifier")]
    pub specifier: String,
    /// ISO 4217 currency code in uppercase (e.g. USD, EUR). Present when a currency format is used.
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
}

impl V1CubeMetaFormatDescription {
    /// Resolved format description with the predefined name and d3-format specifier
    pub fn new(name: String, specifier: String) -> V1CubeMetaFormatDescription {
        V1CubeMetaFormatDescription {
            name,
            specifier,
            currency: None,
        }
    }
}
