use serde::{Deserialize, Serialize};
use super::{fee::Fee, product_id::ProductId};
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct PriceComponentInput {
pub fee: Fee,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub product_id: Option<ProductId>,
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
impl PriceComponentInput {
#[must_use]
pub fn new(fee: Fee, name: impl Into<String>) -> Self {
Self {
fee,
name: name.into(),
product_id: None,
extra: serde_json::Map::new(),
}
}
#[must_use]
pub fn product_id(mut self, product_id: impl Into<ProductId>) -> Self {
self.product_id = Some(product_id.into());
self
}
}