use crate::projects::join::JoinState;
use std::path::PathBuf;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BallSpec {
Existing {
id: String,
title: String,
body: String,
join: JoinState,
tags: Vec<String>,
},
New {
title: String,
body: String,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Payload {
Bare,
Path { dir: PathBuf },
Ball { project: String, ball: BallSpec },
}
impl Payload {
pub fn project(&self) -> Option<String> {
match self {
Self::Ball { project, .. } => Some(project.clone()),
Self::Bare | Self::Path { .. } => None,
}
}
pub fn origin(&self) -> crate::opslog::Origin {
match self {
Self::Ball { .. } => crate::opslog::Origin::Balls,
Self::Bare | Self::Path { .. } => crate::opslog::Origin::Conversation,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StartInputs {
pub workspace: PathBuf,
pub payload: Payload,
pub repo: Option<PathBuf>,
pub home: PathBuf,
pub yog_data_root: PathBuf,
pub balls_state_root: PathBuf,
pub conversation_names: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Step {
EnsureSeeded,
EnsureWorkspace { workspace: PathBuf },
Create {
project: PathBuf,
title: String,
body: String,
},
Claim {
project: PathBuf,
id: String,
name: String,
},
Prompt {
workspace: String,
binding: Option<PathBuf>,
goal: String,
},
}