use serde::{Deserialize, Serialize};
use super::{budget_behavior::BudgetBehavior, currency::Currency};
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct CreateBudgetRequest {
pub amount: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub behavior: Option<BudgetBehavior>,
#[serde(skip_serializing_if = "Option::is_none")]
pub credit_unit: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub currency: Option<Currency>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thresholds: Option<Vec<i32>>,
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
impl CreateBudgetRequest {
#[must_use]
pub fn new(amount: i64) -> Self {
Self {
amount,
behavior: None,
credit_unit: None,
currency: None,
subscription_id: None,
thresholds: None,
extra: serde_json::Map::new(),
}
}
#[must_use]
pub fn behavior(mut self, behavior: impl Into<BudgetBehavior>) -> Self {
self.behavior = Some(behavior.into());
self
}
#[must_use]
pub fn credit_unit(mut self, credit_unit: impl Into<String>) -> Self {
self.credit_unit = Some(credit_unit.into());
self
}
#[must_use]
pub fn currency(mut self, currency: impl Into<Currency>) -> Self {
self.currency = Some(currency.into());
self
}
#[must_use]
pub fn subscription_id(mut self, subscription_id: impl Into<String>) -> Self {
self.subscription_id = Some(subscription_id.into());
self
}
#[must_use]
pub fn thresholds(mut self, thresholds: impl Into<Vec<i32>>) -> Self {
self.thresholds = Some(thresholds.into());
self
}
}