//! Plug-and-play PAS authentication middleware for Axum.
//!
//! This module eliminates OAuth2 boilerplate for Axum applications
//! integrating with [PAS](https://accounts.ppoppo.com) (Ppoppo Accounts System).
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use pas_external::middleware::{PasAuth, PasAuthConfig, SessionResolution};
//!
//! // 1. Implement AccountResolver, SessionStore, and RefreshTokenResolver
//! //    for your app. Typical pattern: one PasAdapter implements all
//! //    three; share a single Arc<PasAdapter>.
//! // 2. Configure from environment.
//! let config = PasAuthConfig::from_env()?;
//!
//! // 3. Bundle the router + a matching SvAwareSessionResolver.
//! let pas_auth = PasAuth::new(
//!     config,
//!     Arc::clone(&adapter),  // AccountResolver
//!     Arc::clone(&adapter),  // SessionStore
//!     Arc::clone(&adapter),  // RefreshTokenResolver
//! );
//! let resolver = pas_auth.resolver();
//!
//! // 4. Mount the router.
//! let app = axum::Router::new()
//!     .merge(pas_auth.into_router());
//!
//! // 5. Use the resolver in your own middleware.
//! match resolver.resolve(&jar).await? {
//!     SessionResolution::Authenticated(ctx) => { /* happy path */ }
//!     SessionResolution::Expired            => { /* cookie stale */ }
//!     SessionResolution::NoCookie           => { /* first visit */ }
//! }
//! ```

mod auth;
mod config;
mod cookies;
mod error;
mod extractor;
mod routes;
mod session;
mod state;
mod sv_aware;
mod traits;
mod types;

pub use auth::PasAuth;
pub use config::PasAuthConfig;
pub use error::AuthError;
pub use extractor::AuthPpnum;
pub use session::{SessionResolution, SessionResolver};
pub use sv_aware::SvAwareSessionResolver;
pub use traits::{AccountResolver, RefreshTokenResolver, SessionStore, SvAware};
pub use types::NewSession;

/// Re-export cookie key type for builder API.
pub use axum_extra::extract::cookie::Key as CookieKey;
