use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct ReadEbookArgs {
pub path: String,
#[serde(default)]
pub extract_metadata: bool,
#[serde(default)]
pub extract_toc: bool,
}
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct WriteEbookArgs {
pub path: String,
pub format: String,
#[serde(default)]
pub title: Option<String>,
#[serde(default)]
pub author: Option<String>,
#[serde(default)]
pub content: Option<String>,
}
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct ExtractImagesArgs {
pub path: String,
}
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct ValidateEbookArgs {
pub path: String,
}
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct GetEbookInfoArgs {
pub path: String,
}
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct ConvertEbookArgs {
pub input_path: String,
pub output_path: String,
pub target_format: String,
}
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct OptimizeImagesArgs {
pub input_path: String,
#[serde(default)]
pub output_path: Option<String>,
#[serde(default = "default_max_dim")]
pub max_width: u64,
#[serde(default = "default_max_dim")]
pub max_height: u64,
#[serde(default = "default_quality")]
pub quality: u64,
#[serde(default)]
pub no_resize: bool,
}
fn default_max_dim() -> u64 {
1920
}
fn default_quality() -> u64 {
85
}