//! Repository Pattern Abstractions
//!
//! This module provides clean data access abstractions that eliminate direct database coupling
//! from business logic components. All database operations are encapsulated behind trait interfaces
//! that can be mocked, tested, and swapped out without affecting core business logic.

pub mod compliance_repository;
pub mod event_repository;
pub mod migration_repository;

// Import repository traits
use crate::repositories::compliance_repository::ComplianceRepository;
use crate::repositories::event_repository::EventRepository;
use crate::repositories::migration_repository::MigrationRepository;

use async_trait::async_trait;
use std::sync::Arc;

/// Repository factory for creating repository implementations
/// This allows dependency injection and easier testing
#[allow(missing_debug_implementations)]
pub struct RepositoryFactory {
    /// Event Repository
    pub event_repository: Arc<dyn EventRepository>,
    /// Compliance Repository
    pub compliance_repository: Arc<dyn ComplianceRepository>,
    /// Migration Repository
    pub migration_repository: Arc<dyn MigrationRepository>,
}

impl RepositoryFactory {
    /// Create a new repository factory with provided implementations
    pub fn new(
        event_repository: Arc<dyn EventRepository>,
        compliance_repository: Arc<dyn ComplianceRepository>,
        migration_repository: Arc<dyn MigrationRepository>,
    ) -> Self {
        Self {
            event_repository,
            compliance_repository,
            migration_repository,
        }
    }
}

/// Health check trait for repositories
#[async_trait]
/// HealthCheck
///
/// Auto-generated documentation placeholder - enhance with specifics
pub trait HealthCheck: Send + Sync {
    async fn health_check(&self) -> Result<(), String>;
}
