use serde::Deserialize;
use serde::Serialize;
#[derive(Serialize, Deserialize)]
pub struct Type(&'static str);
#[allow(dead_code)]
impl Type {
pub const PNG: &'static str = "image/png";
pub const JPEG: &'static str = "image/jpeg";
pub const WEBP: &'static str = "image/webp";
pub const WILDCARD: &'static str = "*/*";
}
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct Convert {
convert_type: String,
}
impl Convert {
pub(crate) fn new<C>(convert_type: C) -> Self
where
C: Into<String>,
{
Self {
convert_type: convert_type.into(),
}
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Color(pub &'static str);
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct Transform {
background: String,
}
impl Transform {
pub(crate) fn new<B>(background: B) -> Self
where
B: AsRef<str> + Into<String>,
{
Self {
background: background.into(),
}
}
}
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct JsonData {
pub(crate) convert: Convert,
transform: Option<Transform>,
}
impl JsonData {
pub(crate) fn new(convert: Convert, transform: Option<Transform>) -> Self {
Self { convert, transform }
}
}