use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(
Debug,
Clone,
PartialEq,
Eq,
Serialize,
Deserialize,
JsonSchema,
arbitrary::Arbitrary,
)]
#[serde(tag = "type", rename_all = "snake_case")]
#[schemars(rename = "agent.script.Script")]
pub enum Script {
Python {
python: String,
},
}
impl Script {
pub fn validate(&self) -> Result<(), String> {
match self {
Script::Python { python } => {
if python.is_empty() {
return Err("`python` must not be empty".to_string());
}
}
}
Ok(())
}
}