use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ShippingZoneCreate {
name: String,
order: i32,
}
impl ShippingZoneCreate {
pub fn new(name: impl Into<String>) -> Self {
Self {
name: name.into(),
order: 0,
}
}
pub fn order(mut self, order: i32) -> Self {
self.order = order;
self
}
}
#[skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct ShippingZoneUpdate {
id: Option<i32>,
name: Option<String>,
order: Option<i32>,
}
impl ShippingZoneUpdate {
pub fn id(mut self, id: i32) -> Self {
let _ = self.id.insert(id);
self
}
pub fn name(mut self, name: impl Into<String>) -> Self {
let _ = self.name.insert(name.into());
self
}
pub fn order(mut self, order: i32) -> Self {
let _ = self.order.insert(order);
self
}
}