"""
Utility functions specific to merchants module.
"""

from src.apps.base.utils.regexp import HOSTNAME, test
from src.core.utils.constants import RESTRICTED_HOSTNAMES


def check_hostname(hostname: str) -> bool:
    """
    Check if a hostname is valid and not restricted.
    
    Args:
        hostname: Hostname string to validate
        
    Returns:
        True if hostname is valid and not restricted, False otherwise
    """
    
    if not hostname:
        return False
    
    # Check if hostname matches the valid format
    if not test(hostname, HOSTNAME):
        return False
    
    # Check if hostname is in restricted list
    if hostname.lower() in [h.lower() for h in RESTRICTED_HOSTNAMES]:
        return False
    
    return True