use serde::{Deserialize, Serialize};
use super::budget_behavior::BudgetBehavior;
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct PatchBudgetRequest {
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "crate::models::codec::nullable"
)]
pub amount: Option<Option<i64>>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "crate::models::codec::nullable"
)]
pub behavior: Option<Option<BudgetBehavior>>,
pub expected_version: i32,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "crate::models::codec::nullable"
)]
pub thresholds: Option<Option<Vec<i32>>>,
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
impl PatchBudgetRequest {
#[must_use]
pub fn new(expected_version: i32) -> Self {
Self {
amount: None,
behavior: None,
expected_version,
thresholds: None,
extra: serde_json::Map::new(),
}
}
#[must_use]
pub fn amount(mut self, amount: impl Into<i64>) -> Self {
self.amount = Some(Some(amount.into()));
self
}
#[must_use]
pub fn clear_amount(mut self) -> Self {
self.amount = Some(None);
self
}
#[must_use]
pub fn behavior(mut self, behavior: impl Into<BudgetBehavior>) -> Self {
self.behavior = Some(Some(behavior.into()));
self
}
#[must_use]
pub fn clear_behavior(mut self) -> Self {
self.behavior = Some(None);
self
}
#[must_use]
pub fn thresholds(mut self, thresholds: impl Into<Vec<i32>>) -> Self {
self.thresholds = Some(Some(thresholds.into()));
self
}
#[must_use]
pub fn clear_thresholds(mut self) -> Self {
self.thresholds = Some(None);
self
}
}