//! ### Cache-Control
//!
//! This module provides functionality to check the "Cache-Control" header in HTTP requests.

use actix_web::HttpRequest;

/// ## Check Cache-Control Header
///
/// This function checks if the "Cache-Control" header in the request is set to "no-cache".
///
/// ### Parameters
///
/// - `req`: A reference to the `HttpRequest` object.
///
/// ### Returns
///
/// - `bool`: Returns `true` if the "Cache-Control" header is set to "no-cache", otherwise returns `false`.
///
/// ### Example
///
/// ```rust,no_run
/// # use actix_web::test::TestRequest;
/// # use athena_rs::api::cache::cache_control::is_cache_control_no_cache;
/// let req = TestRequest::default()
///     .insert_header(("Cache-Control", "no-cache"))
///     .to_http_request();
/// let no_cache = is_cache_control_no_cache(&req);
/// assert!(no_cache);
/// ```
pub fn is_cache_control_no_cache(req: &HttpRequest) -> bool {
    req.headers()
        .get("Cache-Control")
        .is_some_and(|value| value == "no-cache")
}
