
    HCiL                     ,    d dl Z d dlmZmZ dedefdZy)    N)HTTPExceptionstatusvaluereturnc                    | r| j                         st        t        j                  d      | j                         j	                         j                  dd      }t        j                  d|      st        t        j                  d      |S )z
    Normalize a unique_name into a lowercase, hyphen-safe slug.
    Ensures:
    - lowercase
    - no spaces (converted to hyphens)
    - only a-z, 0-9, hyphens, underscores
    zunique_name cannot be empty.)status_codedetail -z[a-z0-9\-_]+zRunique_name may only contain lowercase letters, numbers, hyphens, and underscores.)stripr   r   HTTP_400_BAD_REQUESTlowerreplacere	fullmatch)r   cleaneds     C/var/www/html/story-book/Story-Book-python-api/app/utils/slugify.pynormalize_unique_namer      s{     331
 	
 kkm!!#++C5G <<133g
 	

 N    )r   fastapir   r   strr    r   r   <module>r      s    	 )  r   