pub mod context;
pub mod registry;
pub use context::{TenantContext, TenantId, TenantMetadata};
pub use registry::{TenantRegistry, TenantRegistryError};
use crate::config::AuthConfig;
pub struct TenantRegistryBuilder {
default_config: AuthConfig,
}
impl TenantRegistryBuilder {
pub fn new() -> Self {
Self {
default_config: AuthConfig::default(),
}
}
pub fn with_config(mut self, config: AuthConfig) -> Self {
self.default_config = config;
self
}
pub fn build(self) -> TenantRegistry {
TenantRegistry::new(self.default_config)
}
}
impl Default for TenantRegistryBuilder {
fn default() -> Self {
Self::new()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_tenant_registry_builder() {
let registry = TenantRegistryBuilder::new().build();
assert_eq!(registry.tenant_count().await, 0);
}
}