use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ProjectType {
#[default]
Code,
Docs,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum GitRevertMode {
#[default]
Ask,
Enabled,
Disabled,
}
impl std::str::FromStr for GitRevertMode {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
match value.trim().to_lowercase().as_str() {
"ask" => Ok(GitRevertMode::Ask),
"enabled" => Ok(GitRevertMode::Enabled),
"disabled" => Ok(GitRevertMode::Disabled),
_ => Err("git_revert_mode must be 'ask', 'enabled', or 'disabled'"),
}
}
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum GitPublishMode {
#[default]
Off,
Commit,
CommitAndPush,
}
impl GitPublishMode {
pub const fn as_str(self) -> &'static str {
match self {
GitPublishMode::Off => "off",
GitPublishMode::Commit => "commit",
GitPublishMode::CommitAndPush => "commit_and_push",
}
}
}
impl std::str::FromStr for GitPublishMode {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
match value.trim().to_lowercase().as_str() {
"off" => Ok(GitPublishMode::Off),
"commit" => Ok(GitPublishMode::Commit),
"commit_and_push" => Ok(GitPublishMode::CommitAndPush),
_ => Err("git_publish_mode must be 'off', 'commit', or 'commit_and_push'"),
}
}
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ScanPromptVersion {
V1,
#[default]
V2,
}