//! # `LastID` Rust SDK
//!
//! Rust SDK for integrating with the `LastID` Identity Provider (IDP) to
//! request and verify credentials from users.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use lastid_sdk::policies::BaseCredentialPolicy;
//! use lastid_sdk::ClientBuilder;
//!
//! # async fn example() -> Result<(), lastid_sdk::LastIDError> {
//! // Initialize client
//! let client = ClientBuilder::new().with_auto_config()?.build()?;
//!
//! // Build policy (type-safe)
//! let policy = BaseCredentialPolicy::new()
//!     .with_callback("https://your-app.com/callback");
//!
//! // Request credential
//! let request_id = client.request_credential(policy).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Features
//!
//! - **Type-safe policy builders** with compile-time validation
//! - **8 credential types**: Base, Persona, `VerifiedEmail`, `VerifiedPhone`,
//!   `VerifiedPersona`, Employment, Trust, `AgeProof`
//! - **`DPoP` authentication** (RFC 9449) for proof-of-possession
//! - **Trust registry validation** with 60-second caching
//! - **Async-first** design on tokio runtime
//! - **WASM support** for browser applications

// Forbid unsafe code (FR-029)
#![forbid(unsafe_code)]
// Enable strict lints
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
// Allow common patterns
#![allow(
    clippy::module_name_repetitions,
    clippy::must_use_candidate,
    clippy::missing_errors_doc,
    clippy::missing_panics_doc
)]

// Module declarations
pub mod auth;
pub mod bindings;
pub mod client;
pub mod config;
pub mod constants;
pub mod crypto;
pub mod error;
pub mod http;
pub mod policies;
pub mod shared;
pub mod trust_registry;
pub mod types;
pub mod verification;

// Test utilities (gated by feature)
#[cfg(feature = "test-utils")]
pub mod test_utils;

// WASM bindings (gated by feature and target)
#[cfg(all(feature = "wasm", target_arch = "wasm32"))]
pub mod wasm;

// Node.js native bindings via napi-rs (gated by feature, native only)
#[cfg(all(feature = "napi", not(target_arch = "wasm32")))]
pub mod napi;

// Re-export primary types for ergonomic usage
pub use client::{ClientBuilder, LastIDClient};
pub use config::{CacheConfig, NetworkConfig, PollingConfig, RetryPolicy, SDKConfig};
pub use error::{HttpError, LastIDError, TrustRegistryError};
pub use http::{CorrelationIdConfig, HttpIdpClient, IdpClient};
// Re-export policy builders based on feature flags
#[cfg(feature = "base-policy")]
pub use policies::BaseCredentialPolicy;
// Re-export policy builder trait
pub use policies::PolicyBuilder;
#[cfg(feature = "verified-email-policy")]
pub use policies::VerifiedEmailPolicy;
#[cfg(feature = "verified-phone-policy")]
pub use policies::VerifiedPhonePolicy;
#[cfg(feature = "age-proof-policy")]
pub use policies::{AgeComparison, AgeProofPolicy};
#[cfg(feature = "employment-policy")]
pub use policies::{EmploymentField, EmploymentPolicy, EmploymentStatus};
#[cfg(feature = "persona-policy")]
pub use policies::{PersonaField, PersonaPolicy};
#[cfg(feature = "trust-policy")]
pub use policies::{TrustLevel, TrustPolicy};
#[cfg(feature = "verified-persona-policy")]
pub use policies::{VerificationLevel, VerifiedPersonaField, VerifiedPersonaPolicy};
// Re-export trust registry types
pub use trust_registry::{IssuerInfo, IssuerStatus};
pub use types::{
    ClientId, CredentialRequestResponse, Did, EndpointUrl, RequestId, RequestStatus,
    VerifiedCredential,
};
// Re-export verification types
pub use verification::VerifiablePresentation;
