use clap::{Args, Subcommand};
use crate::cli::task::args::types::{TaskEditFieldArg, TaskPriorityArg, TaskStatusArg};
#[derive(Args, Clone, Debug, Default)]
pub struct BatchSelectArgs {
#[arg(value_name = "TASK_ID...", conflicts_with = "tag_filter")]
pub task_ids: Vec<String>,
#[arg(long, value_name = "TAG", conflicts_with = "task_ids")]
pub tag_filter: Vec<String>,
#[arg(long, value_enum, value_name = "STATUS")]
pub status_filter: Vec<TaskStatusArg>,
#[arg(long, value_enum, value_name = "PRIORITY")]
pub priority_filter: Vec<TaskPriorityArg>,
#[arg(long, value_name = "PATTERN")]
pub scope_filter: Vec<String>,
#[arg(long, value_name = "WHEN")]
pub older_than: Option<String>,
}
#[derive(Subcommand)]
pub enum BatchOperation {
Status(BatchStatusArgs),
Field(BatchFieldArgs),
Edit(BatchEditArgs),
Delete(BatchDeleteArgs),
Archive(BatchArchiveArgs),
Clone(BatchCloneArgs),
Split(BatchSplitArgs),
#[command(name = "plan-append")]
PlanAppend(BatchPlanAppendArgs),
#[command(name = "plan-prepend")]
PlanPrepend(BatchPlanPrependArgs),
}
#[derive(Args)]
pub struct BatchStatusArgs {
#[arg(value_enum)]
pub status: TaskStatusArg,
#[arg(long)]
pub note: Option<String>,
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchFieldArgs {
pub key: String,
pub value: String,
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchEditArgs {
#[arg(value_enum)]
pub field: TaskEditFieldArg,
pub value: String,
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchDeleteArgs {
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchArchiveArgs {
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchCloneArgs {
#[arg(long, value_enum)]
pub status: Option<TaskStatusArg>,
#[arg(long)]
pub title_prefix: Option<String>,
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchSplitArgs {
#[arg(short = 'n', long, default_value = "2")]
pub number: usize,
#[arg(long, value_enum)]
pub status: Option<TaskStatusArg>,
#[arg(long)]
pub title_prefix: Option<String>,
#[arg(long)]
pub distribute_plan: bool,
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchPlanAppendArgs {
#[arg(long = "plan-item", value_name = "ITEM", required = true)]
pub plan_items: Vec<String>,
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct BatchPlanPrependArgs {
#[arg(long = "plan-item", value_name = "ITEM", required = true)]
pub plan_items: Vec<String>,
#[command(flatten)]
pub select: BatchSelectArgs,
}
#[derive(Args)]
pub struct TaskBatchArgs {
#[command(subcommand)]
pub operation: BatchOperation,
#[arg(long)]
pub dry_run: bool,
#[arg(long)]
pub continue_on_error: bool,
}