ralph/contracts/config/
enums.rs1use schemars::JsonSchema;
10use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
14#[serde(rename_all = "snake_case")]
15pub enum ProjectType {
16 #[default]
17 Code,
18 Docs,
19}
20
21#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
23#[serde(rename_all = "snake_case")]
24pub enum GitRevertMode {
25 #[default]
26 Ask,
27 Enabled,
28 Disabled,
29}
30
31impl std::str::FromStr for GitRevertMode {
32 type Err = &'static str;
33
34 fn from_str(value: &str) -> Result<Self, Self::Err> {
35 match value.trim().to_lowercase().as_str() {
36 "ask" => Ok(GitRevertMode::Ask),
37 "enabled" => Ok(GitRevertMode::Enabled),
38 "disabled" => Ok(GitRevertMode::Disabled),
39 _ => Err("git_revert_mode must be 'ask', 'enabled', or 'disabled'"),
40 }
41 }
42}
43
44#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
46#[serde(rename_all = "snake_case")]
47pub enum GitPublishMode {
48 #[default]
50 Off,
51 Commit,
53 CommitAndPush,
55}
56
57impl GitPublishMode {
58 pub const fn as_str(self) -> &'static str {
59 match self {
60 GitPublishMode::Off => "off",
61 GitPublishMode::Commit => "commit",
62 GitPublishMode::CommitAndPush => "commit_and_push",
63 }
64 }
65}
66
67impl std::str::FromStr for GitPublishMode {
68 type Err = &'static str;
69
70 fn from_str(value: &str) -> Result<Self, Self::Err> {
71 match value.trim().to_lowercase().as_str() {
72 "off" => Ok(GitPublishMode::Off),
73 "commit" => Ok(GitPublishMode::Commit),
74 "commit_and_push" => Ok(GitPublishMode::CommitAndPush),
75 _ => Err("git_publish_mode must be 'off', 'commit', or 'commit_and_push'"),
76 }
77 }
78}
79
80#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, JsonSchema)]
82#[serde(rename_all = "snake_case")]
83pub enum ScanPromptVersion {
84 V1,
86 #[default]
88 V2,
89}