use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct OpenRouterProviderConfig {
#[serde(skip_serializing_if = "Option::is_none")]
pub ignore: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub only: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_fallbacks: Option<bool>,
}
impl OpenRouterProviderConfig {
pub fn new() -> Self {
Self::default()
}
pub fn blacklist(mut self, providers: Vec<String>) -> Self {
self.ignore = Some(providers);
self
}
pub fn whitelist(mut self, providers: Vec<String>) -> Self {
self.only = Some(providers);
self
}
pub fn allow_fallbacks(mut self, allow: bool) -> Self {
self.allow_fallbacks = Some(allow);
self
}
pub fn has_rules(&self) -> bool {
self.ignore.is_some() || self.only.is_some() || self.allow_fallbacks.is_some()
}
}