o
    iQ                  
   @   s  d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZmZ d dlmZmZmZmZmZmZmZmZ d dl m!Z!m"Z"m#Z# e#rd dl$m%Z% d dl&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z7 d dl8m9Z9 d dl:m;Z; d dl<m=Z= edG dd ded ed e	d ed ed Z>dS )    )CreateableAPIResource)DeletableAPIResource)ExpandableField)
ListObject)ListableAPIResource)nested_resource_class_methods)SearchResultObject)SearchableAPIResource)StripeObject)UpdateableAPIResource)class_method_variantsanitize_id)AsyncIteratorClassVarDictIteratorListOptionalcastoverload)LiteralUnpackTYPE_CHECKING)Price)ProductFeature)TaxCode)ProductCreateFeatureParams)ProductCreateParams)ProductDeleteFeatureParams)ProductDeleteParams)ProductListFeaturesParams)ProductListParams)ProductModifyParams)ProductRetrieveFeatureParams)ProductRetrieveParams)ProductSearchParamsfeaturec                	   @   s  e Zd ZU dZdZeed  ed< G dd deZ	G dd deZ
eed< 	 eed	< 	 eed
  ed< 	 eed  ed< 	 ee ed< 	 eed< 	 ee ed< 	 eed< 	 ee	 ed< 	 eeef ed< 	 eed< 	 ed ed< 	 ee
 ed< 	 ee ed< 	 ee ed< 	 eed  ed< 	 ed ed< 	 ee ed< 	 eed< 	 ee ed< 	 ed ed! d"d fd#d$Zed ed! d"d fd%d&Zed'ed ed( d"d fd)d*Zeed'ed ed( d"d fd+d,Zed ed( d"d fd-d,Zed.d ed( d"d fd/d,Zed'ed ed( d"d fd0d1Zeed'ed ed( d"d fd2d3Zed ed( d"d fd4d3Zed5d ed( d"d fd6d3Zed ed7 d"ed  fd8d9Zed ed7 d"ed  fd:d;Zeded ed< d"d fd=d>Z eded ed< d"d fd?d@Z!eded edA d"d fdBdCZ"eded edA d"d fdDdEZ#edFedG d"e$d  fdHdIZ%edFedG d"e$d  fdJdKZ&edFedG d"e'd  fdLdMZ(edFedG d"e)d  fdNdOZ*ededed edP d"dQfdRdSZ+ededed edP d"dQfdTdUZ,ededed edV d"dQfdWdXZ-ededed edV d"dQfdYdZZ.eded ed[ d"edQ fd\d]Z/eded ed[ d"edQ fd^d_Z0eded ed` d"dQfdadbZ1eded ed` d"dQfdcddZ2e	e
deZ3dfS )gProducta  
    Products describe the specific goods or services you offer to your customers.
    For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product.
    They can be used in conjunction with [Prices](https://stripe.com/docs/api#prices) to configure pricing in Payment Links, Checkout, and Subscriptions.

    Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription),
    [share a Payment Link](https://stripe.com/docs/payment-links),
    [accept payments with Checkout](https://stripe.com/docs/payments/accept-a-payment#create-product-prices-upfront),
    and more about [Products and Prices](https://stripe.com/docs/products-prices/overview)
    productOBJECT_NAMEc                   @   s   e Zd ZU ee ed< dS )zProduct.MarketingFeaturenameN)__name__
__module____qualname__r   str__annotations__ r0   r0   o/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/env/lib/python3.10/site-packages/stripe/_product.pyMarketingFeatureG   s   
 r2   c                   @   s4   e Zd ZU eed< 	 eed< 	 eed< 	 eed< dS )zProduct.PackageDimensionsheightlengthweightwidthN)r+   r,   r-   floatr/   r0   r0   r0   r1   PackageDimensionsM   s   
 r8   activecreatedr   default_priceTdeleteddescriptionidimageslivemodemarketing_featuresmetadatar*   objectpackage_dimensions	shippablestatement_descriptorr   tax_code)goodservicetype
unit_labelupdatedurlparamsr   returnc                 K   s   t d| jd|  |dS )/
        Creates a new product object.
        r'   postrN   )r   _static_request	class_urlclsrN   r0   r0   r1   create   s   zProduct.createc                    s"   t d| jd|  |dI dH S )rP   r'   rQ   rR   N)r   _static_request_asyncrT   rU   r0   r0   r1   create_async   s   
zProduct.create_asyncsidr   c                 K   *   d|   t|f }td| jd||dS )
        Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
        %s/%sr'   deleterR   rT   r   r   rS   rV   rZ   rN   rM   r0   r0   r1   _cls_delete      zProduct._cls_deletec                 K      dS r\   Nr0   rZ   rN   r0   r0   r1   r^      s   zProduct.deletec                 K   rc   rd   r0   selfrN   r0   r0   r1   r^      s   ra   c                 K   s   | j d|  |dS )r\   r^   rR   )_request_and_refreshinstance_urlrf   r0   r0   r1   r^      s
   c                    2   d|   t|f }td| jd||dI dH S )r\   r]   r'   r^   rR   NrT   r   r   rX   r`   r0   r0   r1   _cls_delete_async      
zProduct._cls_delete_asyncc                       dS rd   r0   re   r0   r0   r1   delete_async  s   zProduct.delete_asyncc                    rn   rd   r0   rf   r0   r0   r1   ro     s   rl   c                    s   | j d|  |dI dH S )r\   r^   rR   N)_request_and_refresh_asyncri   rf   r0   r0   r1   ro     s   r!   c                 K   s4   | j d|  |d}t|tstdt|j |S )
        Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
        getrR   %Expected list object from API, got %s)rS   rT   
isinstancer   	TypeErrorrJ   r+   rV   rN   resultr0   r0   r1   list,  s   
zProduct.listc                    s<   | j d|  |dI dH }t|tstdt|j |S )rq   rr   rR   Nrs   )rX   rT   rt   r   ru   rJ   r+   rv   r0   r0   r1   
list_async@  s   
zProduct.list_asyncr"   c                 K   r[   )
        Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
        r]   r'   rQ   rR   r_   rV   r>   rN   rM   r0   r0   r1   modifyT  rb   zProduct.modifyc                    rj   )rz   r]   r'   rQ   rR   Nrk   r{   r0   r0   r1   modify_asynce  rm   zProduct.modify_asyncr$   c                 K   s   | |fi |}|   |S )
        Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
        )refreshrV   r>   rN   instancer0   r0   r1   retrievev  s   zProduct.retrievec                    s$   | |fi |}|  I dH  |S )r~   N)refresh_asyncr   r0   r0   r1   retrieve_async  s   zProduct.retrieve_asynckwargsr%   c                 O   s   | j |ddi|S )  
        Search for products you've previously created using Stripe's [Search Query Language](https://docs.stripe.com/docs/search#search-query-language).
        Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
        conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
        to an hour behind during outages. Search functionality is not available to merchants in India.
        
search_url/v1/products/search)_searchrV   argsr   r0   r0   r1   search  s   
zProduct.searchc                    s   | j |ddi|I dH S )r   r   r   N)_search_asyncr   r0   r0   r1   search_async  s   
zProduct.search_asyncc                 O   s   | j |i | S N)r   auto_paging_iterr   r0   r0   r1   search_auto_paging_iter  s   zProduct.search_auto_paging_iterc                    s   | j |i |I d H  S r   )r   r   r   r0   r0   r1   search_auto_paging_iter_async  s   z%Product.search_auto_paging_iter_asyncr   r   c                 K   (   t d| jddjt|t|d|dS )=
        Deletes the feature attachment to a product
        r   r^   $/v1/products/{product}/features/{id}r(   r>   rR   r   rS   formatr   rV   r(   r>   rN   r0   r0   r1   delete_feature     
zProduct.delete_featurec                    0   t d| jddjt|t|d|dI dH S )r   r   r^   r   r   rR   Nr   rX   r   r   r   r0   r0   r1   delete_feature_async     

zProduct.delete_feature_asyncr#   c                 K   r   )a
        Retrieves a product_feature, which represents a feature attachment to a product
        r   rr   r   r   rR   r   r   r0   r0   r1   retrieve_feature  r   zProduct.retrieve_featurec                    r   )r   r   rr   r   r   rR   Nr   r   r0   r0   r1   retrieve_feature_async  r   zProduct.retrieve_feature_asyncr    c                 K   s&   t td | jddjt|d|dS );
        Retrieve a list of features for a product
        r   rr   /v1/products/{product}/featuresr(   rR   )r   r   rS   r   r   rV   r(   rN   r0   r0   r1   list_features  s   zProduct.list_featuresc                    s.   t td | jddjt|d|dI dH S )r   r   rr   r   r   rR   N)r   r   rX   r   r   r   r0   r0   r1   list_features_async  s   
zProduct.list_features_asyncr   c                 K   s"   t d| jddjt|d|dS )_
        Creates a product_feature, which represents a feature attachment to a product
        r   rQ   r   r   rR   r   r   r0   r0   r1   create_feature*  s   zProduct.create_featurec                    s*   t d| jddjt|d|dI dH S )r   r   rQ   r   r   rR   Nr   r   r0   r0   r1   create_feature_async<  s   
zProduct.create_feature_async)rA   rD   N)4r+   r,   r-   __doc__r)   r   r   r/   r
   r2   r8   boolintr   r   r.   r   r   classmethodr   rW   rY   ra   r   staticmethodr^   r   rl   ro   r   rx   ry   r|   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   _inner_class_typesr0   r0   r0   r1   r'   2   s  
 


r'   N)?stripe._createable_api_resourcer   stripe._deletable_api_resourcer   stripe._expandable_fieldr   stripe._list_objectr   stripe._listable_api_resourcer   %stripe._nested_resource_class_methodsr   stripe._search_result_objectr   stripe._searchable_api_resourcer	   stripe._stripe_objectr
   stripe._updateable_api_resourcer   stripe._utilr   r   typingr   r   r   r   r   r   r   r   typing_extensionsr   r   r   stripe._pricer   stripe._product_featurer   stripe._tax_coder   ,stripe.params._product_create_feature_paramsr   $stripe.params._product_create_paramsr   ,stripe.params._product_delete_feature_paramsr   $stripe.params._product_delete_paramsr   +stripe.params._product_list_features_paramsr    "stripe.params._product_list_paramsr!   $stripe.params._product_modify_paramsr"   .stripe.params._product_retrieve_feature_paramsr#   &stripe.params._product_retrieve_paramsr$   $stripe.params._product_search_paramsr%   r'   r0   r0   r0   r1   <module>   sF   (


