
    Di                        d Z ddlmZmZ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 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m Z   e       Z!e!jE                  d      dee#ef   fd       Z$e!jE                  dee#ef         de#fd       Z%e!jE                  dee#ef         de#fd       Z%y)z
Files router module.

This module provides API endpoints for file management operations including
upload, download, listing, and deletion of files.
    )ListDictAnyOptional)	APIRouterDependsQuery
UploadFileFileFormHTTPExceptionstatus)Session)Response)get_db)get_current_active_user)User)file_services)	FileTypes)DEFAULT_SUBSCRIPTION_LISTDEFAULT_SUBSCRIPTION_DETAILS"DEFAULT_SUBSCRIPTION_ACTIVITY_LIST returnc                     K   	 t         } | ddddddddddddd	d
S # t        $ r)}t        t        j                  t        |            d}~ww xY ww)z+
    List all available subscriptions.
          
   F)totalpageper_pagetotal_pageshas_nexthas_previousNz$/api/v1/customers?page=1&per_page=10)nextpreviousfirstlastT)datametalinkssuccessstatus_codedetail)r   	Exceptionr   r   HTTP_400_BAD_REQUESTstr)responsees     [/var/www/html/hwPaymentPortal-be-dev/hw-payment-portal-api/src/apps/subscriptions/router.pylist_subscriptionsr6   $   sx     
T, ! %  ?>	 !
 	
$  T(C(CCPQFSSTs$   A A	A$A

AAz/{id})response_modelidc                    K   	 t         ddd}|S # t        $ r)}t        t        j                  t        |            d}~ww xY ww)z#
    Get a subscription by id.
    Tz*Subscription details fetched successfully.)r)   r,   messager-   N)r   r0   r   r   r1   r2   r8   r3   r4   s      r5   get_subscriptionr<   A   sL     T0C

  T(C(CCPQFSST"   A A	A$=AAz/{id}/activitiesc                    K   	 t         ddd}|S # t        $ r)}t        t        j                  t        |            d}~ww xY ww)a  
    Get a subscription by id.
    ```
    {
        "data": [
            {
                "level": "info",
                "event": "EVENTS.AUTHORIZATION.CREATE",
                "message": "MFX Corp. has authorized a CHECKBOX authorization on behalf of Theriton Corp.  ",
                "module": "authorization",
                "submodule": "authorization",
                "data": null,
                "created_by": "Mason  Fox",
                "created_by_id": "54",
                "merchant_id": null,
                "customer_id": null,
                "contact_id": null,
                "receipt_id": null,
                "invoice_id": null,
                "payment_request_id": null,
                "product_slug": null,
                "authorization_type": "default",
                "authorization_id": "auth_7cZYJ3uL6aWoeKQ",
                "ip_address": "223.185.30.151",
                "phone": null,
                "contract_id": null,
                "checkout_id": null,
                "created_at": "2024-10-07T07:26:13.741000"
            }
        ],
        "message": "Activities fetched successfully",
        "success": true
    }
    ```
    zActivities fetched successfullyT)r)   r:   r,   r-   N)r   r0   r   r   r1   r2   r;   s      r5   r<   r<   U   sM     RT68

  T(C(CCPQFSSTr=   N)&__doc__typingr   r   r   r   fastapir   r   r	   r
   r   r   r   r   sqlalchemy.ormr   starlette.responsesr   src.core.databaser   src.apps.auth.utils.authr   src.apps.users.models.userr   src.apps.filesr   src.core.utils.enumsr   .src.apps.subscriptions.subscriptions_constantsr   r   r   routergetr2   r6   r<        r5   <module>rN      s    - ,	 	 	 # ( $ < + ( *  
 BT$sCx. T T8 GDcN3TT 4T& tCH~>0T0T ?0TrM   