//! # lmrc-auth
//!
//! Authentication framework for LMRC Stack applications.
//!
//! This library provides a flexible authentication system with support for:
//! - Multiple authentication providers (database, LDAP, OAuth, etc.)
//! - Session management
//! - Password hashing
//! - Authentication middleware for Axum
//! - Ready-to-use HTTP handlers
//!
//! ## Features
//!
//! - `bcrypt` (default) - Password hashing with bcrypt
//! - `database` - Database-backed authentication provider with SeaORM
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use lmrc_auth::{AuthProvider, DatabaseAuthProvider, AuthConfig};
//! use sea_orm::Database;
//! use std::sync::Arc;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//!     let db = Database::connect("postgres://localhost/mydb").await?;
//!
//!     let auth_provider = Arc::new(
//!         DatabaseAuthProvider::new(
//!             db,
//!             "users",
//!             "sessions",
//!             AuthConfig::default()
//!         )
//!     );
//!
//!     // Use in your Axum application
//!     Ok(())
//! }
//! ```

pub mod error;
pub mod models;
pub mod traits;

#[cfg(feature = "database")]
pub mod providers;

pub mod handlers;
pub mod middleware;

// Re-export commonly used types
pub use error::{AuthError, AuthResult};
pub use models::{AuthUser, Credentials, LoginResponse, Session};
pub use traits::{AuthProvider, SessionStore};

#[cfg(feature = "database")]
pub use providers::DatabaseAuthProvider;

/// Authentication configuration
#[derive(Debug, Clone)]
pub struct AuthConfig {
    /// Session expiration in hours
    pub session_expiration_hours: i64,
    /// Cookie name for session token
    pub cookie_name: String,
    /// Cookie domain (optional)
    pub cookie_domain: Option<String>,
    /// Cookie secure flag (use HTTPS only)
    pub cookie_secure: bool,
}

impl Default for AuthConfig {
    fn default() -> Self {
        Self {
            session_expiration_hours: 168, // 7 days
            cookie_name: "session_token".to_string(),
            cookie_domain: None,
            cookie_secure: true,
        }
    }
}
