use axum::extract::FromRequestParts;
use http::request::Parts;
use uuid::Uuid;

/// Extractor that ensures the request is associated with a valid, active license.
/// Should be used after AuthUser — it reads the license_id from the authenticated user's claims
/// and verifies the license exists, is active, and has the required modules enabled.
#[derive(Debug, Clone)]
pub struct ValidLicense {
    pub license_id: Uuid,
    pub status: String,
    pub modules: Vec<String>,
}

// TODO: Implement license validation logic
// - Retrieve license_id from AuthUser claims (or from request extensions)
// - Query the database to confirm the license exists and is active
// - Check that the license hasn't expired
// - Populate the modules list for downstream permission checks
// - Return 403 Forbidden if the license is invalid, expired, or suspended

impl<S> FromRequestParts<S> for ValidLicense
where
    S: Send + Sync,
{
    type Rejection = http::StatusCode;

    async fn from_request_parts(_parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
        todo!()
    }
}
