
    Ei?                        d Z ddlmZmZmZ ddl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  G d d	e      Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)z*
Common schema definitions and utilities.
    )AnyDictOptional)	BaseModelfield_validator
ConfigDictField)Query)AddressTypes)Json)datetimec                   H    e Zd Z ed      Z edd      ed               Zy)
BaseSchemaT)from_attributes*before)modec                 F    t        |t              r|j                         S |S )N)
isinstancer
   all)clsvs     Z/var/www/html/hwPaymentPortal-be-dev/hw-payment-portal-api/src/apps/base/schemas/common.pyevaluate_lazy_columnsz BaseSchema.evaluate_lazy_columns   s     a557N    N)__name__
__module____qualname__r   model_configr   classmethodr    r   r   r   r      s-    d3LSx(  )r   r   c                   x    e Zd ZU dZ edd      Zeed<    edd      Ze	e
   ed<    edd	      Ze	e   ed
<   y)CommonResponsez,Common response structure for API endpoints.Tz'Indicates if the request was successfuldescriptionsuccessNzOptional messagemessagezResponse datadata)r   r   r   __doc__r	   r&   bool__annotations__r'   r   strr(   r   r!   r   r   r#   r#      sB    6$,UVGTV"45GHGXc]H/BD(3-Br   r#   c                   |    e Zd ZU dZ edd      Zeed<    edd      Ze	ed<    ed	d
      Z
eee	ef      ed<   y	)ErrorResponsezError response structure.Fz Always false for error responsesr$   r&   .zError messageerrorNzAdditional error detailsdetails)r   r   r   r)   r	   r&   r*   r+   r/   r,   r0   r   r   r   r!   r   r   r.   r.       sG    #%-OPGTPs8E38(-d@Z([GXd38n%[r   r.   c                       e Zd ZU dZ edd      Zeed<    edd      Zeed<    edd      Z	eed	<    edd
      Z
eed<    edd      Zeed<    edd      Zeed<   y)PaginationMetazPagination metadata..zTotal number of itemsr$   totalzCurrent page numberpagezItems per pageper_pagezTotal number of pagestotal_pageszWhether there is a next pagehas_nextz Whether there is a previous pagehas_previousN)r   r   r   r)   r	   r3   intr+   r4   r5   r6   r7   r*   r8   r!   r   r   r2   r2   (   sq    s(?@E3@c'<=D#=#+;<Hc<S.EFKF3,JKHdKs0RSL$Sr   r2   c                       e Zd ZU dZ edd      Zee   ed<    edd      Z	e
ed<    edd      Zeeee   f   ed	<   y
)PaginatedResponsezPaginated response structure..zList of itemsr$   r(   zPagination metadatametazNavigation linkslinksN)r   r   r   r)   r	   r(   listr   r+   r<   r2   r=   r   r,   r   r!   r   r   r;   r;   3   sL    'C_=D$s)= 2GHD.H&+C=O&PE4Xc]"#Pr   r;   c                      e Zd ZU  ed      Zeed<    edd      Zee   ed<    ed      Z	eed	<    ed
      Z
eed<    ed      Zeed<    edd      Zee   ed<    edej                        Zee   ed<    edd      Zee   ed<    edd      Zee   ed<    edd      Zee   ed<    edd      Zee   ed<    edd      Zee   ed<    edd       Zee   ed!<   y)"AddressBasezaddress line 1r$   address_line_1Nzaddress line 2defaultr%   address_line_2zZIP Code of addresszipcodezISO code of residing citycityzISO code of residing statestateUSzISO code of residing countrycountryzType of address being used)r%   rC   address_typezAttention of the address	attentionzlocation json datalocation_datazlocation latitudelatzlocation longitudelngFz^Whether use this address as default address or not. Applicable when address_type is `shipping`use_as_defaultTz:Whether this address is being used by the customer or not?	is_active)r   r   r   r	   rA   r,   r+   rD   r   rE   rF   rG   rI   r   BILLINGrJ   rK   rL   r   rM   floatrN   rO   r*   rP   r!   r   r   r@   r@   ;   s!   ,<=NC=$)$DT$UNHSMU%:;GS;"=>D#>#?@E3@"4=[\GXc]\+00,:N:N,L(<(   %T7QRIx}R$)$<P$QM8D>Q 3FGC%G 3GHC%H%*t&NHTN  !&P!Ix~ r   r@   c                   B    e Zd ZdZ edddddddd	d
ddddddi      Zy)AddressCreateRequestSchemaz"Schema for creating new addresses.Texamplez123 Main StreetzApartment 4B10001zNew YorkNYrH   billingzJohn Doegw#aD@gR)rA   rD   rE   rF   rG   rI   rJ   rK   rO   rP   rM   rN   )r   json_schema_extraN)r   r   r   r)   r   r   r!   r   r   rT   rT   S   sC    ,"3"0"" )'"&!
Lr   rT   c                       e Zd ZU  ed      Zeed<    edd      Zee	   ed<    edd      Z
ee	   ed	<    edd
      Zee	   ed<   y)AddressSchemazId of Address resourcer$   idNz'Created date and time as unix timestamprB   
created_atz'Updated date and time as unix timestamp
updated_atz'Deleted date and time as unix timestamp
deleted_at)r   r   r   r	   r\   r9   r+   r]   r   r   r^   r_   r!   r   r   r[   r[   j   sj     89B9%*=&J"  &+=&J"  &+=&J" r   r[   N)r)   typingr   r   r   pydanticr   r   r   r	   sqlalchemy.ormr
   src.core.utils.enumsr   pydantic.typesr   r   r   r#   r.   r2   r;   r@   rT   r[   r!   r   r   <module>re      s    ' & B B   -   CY C\I \TY TQ	 Q* 0 .K r   