use crate::tui::{app::RunOptions, event::AppEvent};
use std::path::PathBuf;
use tokio_util::sync::CancellationToken;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FilePickerMode {
Required {
extension: &'static str,
exclude_stem_suffix: Option<&'static str>,
},
NotNeeded,
}
#[derive(Debug, Clone)]
pub enum CommandOption {
Toggle { label: &'static str, default: bool },
Numeric {
label: &'static str,
default: i32,
step: i32,
min: i32,
max: i32,
unit: &'static str,
},
Text {
label: &'static str,
default: &'static str,
placeholder: &'static str,
},
}
pub trait TuiCommand: std::fmt::Debug + Send + Sync {
fn id(&self) -> &'static str;
fn title(&self) -> &'static str;
fn description(&self) -> &'static str;
fn file_picker_mode(&self) -> FilePickerMode;
fn options(&self) -> Vec<CommandOption>;
fn execute(
&self,
files: Vec<PathBuf>,
options: &RunOptions,
cancel: CancellationToken,
ffmpeg_path: &std::path::Path,
tx: std::sync::mpsc::Sender<AppEvent>,
) -> anyhow::Result<()>;
}