use schemars::JsonSchema;
use serde::Deserialize;
use trine::NativePath;
#[derive(Default, Deserialize, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct RecoverInput {
pub task: Option<String>,
#[serde(default)]
pub activate_here: bool,
pub workspace: Option<NativePath>,
#[serde(default)]
pub undo: bool,
#[serde(default)]
pub yes: bool,
#[serde(default)]
pub force: bool,
}
#[derive(Deserialize, JsonSchema)]
#[serde(deny_unknown_fields)]
pub(crate) struct NamedParticipantRecovery {
pub task: String,
pub workspace: Option<NativePath>,
}
#[derive(Deserialize, JsonSchema)]
#[serde(from = "RecoverInput")]
#[schemars(rename = "RecoverInput")]
pub(crate) enum RecoveryRequest {
General(RecoverInput),
Participants(NamedParticipantRecovery),
}
impl From<RecoverInput> for RecoveryRequest {
fn from(input: RecoverInput) -> Self {
Self::General(input)
}
}