
    1i2                     B    d Z ddlmZ dedeeef   fdZdededefdZy)	z=Service for calculating product pricing based on pack counts.    )Dictmspreturnc           	          ddddddddddd	dd
d	ddd	ddd	dd}i }|j                         D ])  \  }}| |d   z  }||d   z  }||z
  }t        |d      ||<   + |S )a  
    Calculate violation pricing threshold for each pack count.
    
    Formula:
    - 1 pack: MSP * 1 - 10% = MSP * 0.9
    - 2 packs: MSP * 2 - 20% = MSP * 1.6
    - 3 packs: MSP * 3 - 33% = MSP * 2.01
    - 4 packs: MSP * 4 - 35% = MSP * 2.6
    - 5+ packs: MSP * pack_count - 35% = MSP * pack_count * 0.65
    
    Args:
        msp: Base Minimum Selling Price (single unit)
    
    Returns:
        Dictionary mapping pack count to calculated minimum price
       g?)
multiplierdiscount   g?   gQ?   gffffff?         )r   r
   r   r   r   r   r   r   r	   )itemsround)r   pack_configspack_prices
pack_countconfig
base_pricediscount_amountprices           B/var/www/html/marco-python-backend/app/services/pricing_service.pycalculate_pack_pricesr      s    $ ......40L K*002 2
F6,//
$vj'99_,"'q/J	2     r   c                 <    t        |       }|j                  |d      S )a  
    Get the violation pricing threshold for a specific pack count.
    
    Args:
        msp: Base Minimum Selling Price
        pack_count: Number of packs (1, 2, 3, 4, 5, 6, or 12)
    
    Returns:
        Calculated minimum price for that pack count
    r   )r   get)r   r   pricess      r   get_pack_pricer   )   s     #3'F::j!$$r   N)__doc__typingr   floatintr   r    r   r   <module>r%      sB    C "u "c5j)9 "J% %3 %5 %r   