"""HTTP transport and content helpers."""

from __future__ import annotations

import time

from .body import (
    DEFAULT_MAX_COMPRESSED_BODY_MULTIPLIER,
    DEFAULT_MAX_RESPONSE_BYTES,
    TEXTUAL_CONTENT_TYPES,
    build_text_preview,
    decompress_gzip_body,
    is_textual_content_type,
    is_xml_content_type,
    normalize_content_encoding,
)
from .cache import (
    CACHE_KEY_HEADER_NAMES,
    CACHE_STAT_KEYS,
    DEFAULT_CACHE_CAPACITY,
    DEFAULT_CACHE_TTL_SECONDS,
    DEFAULT_DISK_CACHE_MAX_AGE_DAYS,
    DEFAULT_DISK_CACHE_MAX_AGE_SECONDS,
    DEFAULT_DISK_CACHE_MAX_BYTES,
    DEFAULT_DISK_CACHE_MAX_ENTRIES,
    DEFAULT_MAX_CACHEABLE_BODY_BYTES,
    DEFAULT_MAX_TOTAL_CACHE_BYTES,
    DEFAULT_METADATA_CACHE_TTL_SECONDS,
    DISK_CACHE_ROOT_NAME,
    DISK_CACHE_VERSION,
    REDACTED_CACHE_HEADER_DIGEST_PREFIX,
    REDACTED_CACHE_VALUE,
    SENSITIVE_CACHE_HEADER_NAMES,
    SENSITIVE_QUERY_PARAM_NAMES,
    UNSTABLE_CACHE_HEADER_NAMES,
    _CacheKey,
    _DiskCacheEntry,
    redact_url_for_cache,
)
from .content_types import (
    PDF_ACCEPT_HEADER,
    PDF_MIME_TYPE,
    STRUCTURED_TEXT_MIME_TYPES,
    content_type_base,
    is_pdf_content_type,
)
from .errors import (
    RequestCancelledError,
    RequestErrorCategory,
    RequestFailure,
    build_http_error_message,
    build_network_error_detail,
    classify_network_error,
    is_timeout_network_error,
    iter_network_error_causes,
)
from .retry import (
    DEFAULT_TRANSIENT_BACKOFF_BASE_SECONDS,
    DEFAULT_TRANSIENT_RETRIES,
    TRANSIENT_HTTP_STATUS_CODES,
    is_transient_http_status,
    parse_retry_after_seconds,
)
from .transport import (
    DEFAULT_FULLTEXT_TIMEOUT_SECONDS,
    DEFAULT_PER_HOST_CONCURRENCY,
    DEFAULT_POOL_MAXSIZE,
    DEFAULT_POOL_NUM_POOLS,
    DEFAULT_TIMEOUT_SECONDS,
    HttpTransport,
    _PreparedRequest,
    logger,
)

__all__ = [
    "CACHE_KEY_HEADER_NAMES",
    "CACHE_STAT_KEYS",
    "DEFAULT_CACHE_CAPACITY",
    "DEFAULT_CACHE_TTL_SECONDS",
    "DEFAULT_DISK_CACHE_MAX_AGE_DAYS",
    "DEFAULT_DISK_CACHE_MAX_AGE_SECONDS",
    "DEFAULT_DISK_CACHE_MAX_BYTES",
    "DEFAULT_DISK_CACHE_MAX_ENTRIES",
    "DEFAULT_FULLTEXT_TIMEOUT_SECONDS",
    "DEFAULT_MAX_CACHEABLE_BODY_BYTES",
    "DEFAULT_MAX_COMPRESSED_BODY_MULTIPLIER",
    "DEFAULT_MAX_RESPONSE_BYTES",
    "DEFAULT_MAX_TOTAL_CACHE_BYTES",
    "DEFAULT_METADATA_CACHE_TTL_SECONDS",
    "DEFAULT_PER_HOST_CONCURRENCY",
    "DEFAULT_POOL_MAXSIZE",
    "DEFAULT_POOL_NUM_POOLS",
    "DEFAULT_TIMEOUT_SECONDS",
    "DEFAULT_TRANSIENT_BACKOFF_BASE_SECONDS",
    "DEFAULT_TRANSIENT_RETRIES",
    "DISK_CACHE_ROOT_NAME",
    "DISK_CACHE_VERSION",
    "PDF_ACCEPT_HEADER",
    "PDF_MIME_TYPE",
    "REDACTED_CACHE_HEADER_DIGEST_PREFIX",
    "REDACTED_CACHE_VALUE",
    "SENSITIVE_CACHE_HEADER_NAMES",
    "SENSITIVE_QUERY_PARAM_NAMES",
    "STRUCTURED_TEXT_MIME_TYPES",
    "TEXTUAL_CONTENT_TYPES",
    "TRANSIENT_HTTP_STATUS_CODES",
    "UNSTABLE_CACHE_HEADER_NAMES",
    "HttpTransport",
    "RequestCancelledError",
    "RequestErrorCategory",
    "RequestFailure",
    "_CacheKey",
    "_DiskCacheEntry",
    "_PreparedRequest",
    "build_http_error_message",
    "build_network_error_detail",
    "build_text_preview",
    "classify_network_error",
    "content_type_base",
    "decompress_gzip_body",
    "is_pdf_content_type",
    "is_textual_content_type",
    "is_timeout_network_error",
    "is_transient_http_status",
    "is_xml_content_type",
    "iter_network_error_causes",
    "logger",
    "normalize_content_encoding",
    "parse_retry_after_seconds",
    "redact_url_for_cache",
    "time",
]
