use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CostsResult {
#[serde(rename = "object")]
pub object: Object,
#[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
pub amount: Option<Box<models::CostsResultAmount>>,
#[serde(
rename = "line_item",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub line_item: Option<Option<String>>,
#[serde(
rename = "project_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub project_id: Option<Option<String>>,
}
impl CostsResult {
pub fn new(object: Object) -> CostsResult {
CostsResult {
object,
amount: None,
line_item: None,
project_id: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
#[serde(rename = "organization.costs.result")]
OrganizationCostsResult,
}
impl Default for Object {
fn default() -> Object {
Self::OrganizationCostsResult
}
}
impl std::fmt::Display for CostsResult {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}