use crate::auth::{Auth, NoAuth, OAuth2Auth, StaticSecretAuth};
use crate::config::provider::{AuthId, ProtocolId};
use crate::protocol::anthropic::AnthropicMessages;
use crate::protocol::claude_code::ClaudeCode;
use crate::protocol::google_genai::GoogleGenAi;
use crate::protocol::ollama_chat::OllamaChat;
use crate::protocol::openai::OpenAiChat;
use crate::protocol::openai_responses::OpenAiResponses;
use crate::protocol::Protocol;
pub struct Registry;
impl Registry {
pub fn builtin() -> Self {
Registry
}
pub fn protocol(&self, id: ProtocolId) -> &'static dyn Protocol {
match id {
ProtocolId::OpenAiChat => &OpenAiChat,
ProtocolId::AnthropicMessages => &AnthropicMessages,
ProtocolId::OpenAiResponses => &OpenAiResponses,
ProtocolId::GoogleGenAi => &GoogleGenAi,
ProtocolId::OllamaChat => &OllamaChat,
ProtocolId::ClaudeCode => &ClaudeCode,
}
}
pub fn auth(&self, id: AuthId) -> &'static dyn Auth {
match id {
AuthId::ApiKey | AuthId::Bearer => &StaticSecretAuth,
AuthId::OAuth2 => &OAuth2Auth,
AuthId::None => &NoAuth,
}
}
}