use image::ImageFormat;
use object_store::path::Path;
use serde::Deserialize;
use std::sync::Arc;
use tokio::sync::RwLock;
#[derive(Debug)]
pub struct ImageThumbs<T> {
pub(crate) client: Arc<RwLock<T>>,
pub(crate) settings: Arc<Vec<Params>>,
}
impl<T> Clone for ImageThumbs<T> {
fn clone(&self) -> Self {
Self {
client: Arc::clone(&self.client),
settings: Arc::clone(&self.settings),
}
}
}
#[derive(Deserialize, Debug, Clone)]
pub struct Params {
pub name: String,
pub naming_pattern: Option<String>,
pub quality: u8,
pub size: (u32, u32),
pub mode: Mode,
}
#[derive(Deserialize, Debug, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum Mode {
Fit,
Crop,
}
#[derive(Debug)]
pub(crate) struct ImageDetails {
pub(crate) stem: String,
pub(crate) format: ImageFormat,
pub(crate) path: Path,
pub(crate) bytes: Vec<u8>,
}