use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum Provider {
Anthropic,
OpenAI,
Google,
}
impl std::fmt::Display for Provider {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Provider::Anthropic => write!(f, "anthropic"),
Provider::OpenAI => write!(f, "openai"),
Provider::Google => write!(f, "google"),
}
}
}
impl std::str::FromStr for Provider {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"anthropic" => Ok(Provider::Anthropic),
"openai" => Ok(Provider::OpenAI),
"google" => Ok(Provider::Google),
_ => Err(format!("Unknown provider: {}", s)),
}
}
}