codex_execpolicy/
decision.rs1use serde::Deserialize;
2use serde::Serialize;
3
4use crate::error::Error;
5use crate::error::Result;
6
7#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub enum Decision {
10 Allow,
12 Prompt,
14 Forbidden,
16}
17
18impl Decision {
19 pub fn parse(raw: &str) -> Result<Self> {
20 match raw {
21 "allow" => Ok(Self::Allow),
22 "prompt" => Ok(Self::Prompt),
23 "forbidden" => Ok(Self::Forbidden),
24 other => Err(Error::InvalidDecision(other.to_string())),
25 }
26 }
27}