mangadex_api_schema_rust/v5/
upload_required_approval.rsuse mangadex_api_types::ResultType;
use serde::Deserialize;
use crate::FromResponse;
#[derive(Clone, Debug, Deserialize, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "non_exhaustive", non_exhaustive)]
#[allow(unused)]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct UploadRequiredApproval {
#[serde(default)]
pub result: ResultType,
#[serde(default)]
pub requires_approval: Option<bool>,
}
impl From<bool> for UploadRequiredApproval {
fn from(value: bool) -> Self {
Self {
result: Default::default(),
requires_approval: Some(value),
}
}
}
impl UploadRequiredApproval {
pub fn is_manga_not_found(&self) -> bool {
self.requires_approval.is_none()
}
}
impl From<UploadRequiredApproval> for bool {
fn from(value: UploadRequiredApproval) -> Self {
value.requires_approval.unwrap_or_default()
}
}
impl FromResponse for UploadRequiredApproval {
type Response = Self;
fn from_response(res: Self::Response) -> Self {
res
}
}