//! Host normalization and wildcard-pattern parsing helpers.

use athena_dns::PublicHostRoute;

/// Extracts a client prefix from a host header using a wildcard pattern.
pub fn extract_prefix_from_host(host_header: &str, wildcard_pattern: &str) -> Option<String> {
    parse_public_host_route(host_header, wildcard_pattern).map(|route| route.route_key)
}

/// Parses a canonical Athena public host or a service-alias host.
pub fn parse_public_host_route(
    host_header: &str,
    wildcard_pattern: &str,
) -> Option<PublicHostRoute> {
    athena_dns::parse_public_host_route(host_header, wildcard_pattern)
}

/// Builds one concrete host from a wildcard pattern and one validated prefix.
pub fn build_host_from_prefix(prefix: &str, wildcard_pattern: &str) -> Option<String> {
    athena_dns::build_host_from_prefix(prefix, wildcard_pattern)
}
