"""Helpers for reading values from the Flask request object."""

from flask import request


def parse_bool_arg(name: str, default: bool = False) -> bool:
    """Parse a query-string parameter as a boolean.

    Returns ``True`` only when the raw value lowercases to ``"true"``;
    returns *default* when the parameter is absent. Whitespace is not
    stripped, matching the inline pattern this helper replaces.
    """
    raw = request.args.get(name)
    if raw is None:
        return default
    return raw.lower() == "true"
