
    	,h	                     p    d dl mZ d dl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  G d d	      Zy
)    )schema)CorporateConceptOfficeBaseTblCorporateConceptOffice)CustomResponse)Session)JWTPayloadSchema)Messages)HTTPExceptionc                   t    e Zd ZdedefdZdej                  fdZde	fdZ
dej                  fdZde	fd	Zy
)CorporateConceptOfficeServicedbtokenc                      || _         || _        y )N)r   r   )selfr   r   s      C/var/www/html/RetailAPI/app/api/corporate_concept_office/service.py__init__z&CorporateConceptOfficeService.__init__
   s    
    requestc                    K   t        j                  |j                               }t        j                  || j
                         | j
                  j                          t        dt        j                        S w)N1statusmessage)
r   model_validate
model_dumpr   create_corporate_concept_officer   commitr   r	   CORPORATE_CONCEPT_OFFICE)r   r    created_corporate_concept_offices      r   r   z=CorporateConceptOfficeService.create_corporate_concept_office   sZ     +E+T+TU\UgUgUi+j(!AABbdhdkdklS(2S2STTs   A9A;group_idc                    K   t        j                  || j                        }|st        dd      |D cg c]!  }t        j
                  j                  |      # c}S c c}w w)Ni  zGet group ID not found)status_codedetail)r   get_corporate_concept_officer   r
   r   CorporateConceptOfficeResponser   )r   r     new_get_corporate_concept_office	get_groups       r   r$   z:CorporateConceptOfficeService.get_corporate_concept_office   sv     +D+a+abjlplsls+t(/C8PQQ bB  C  bBT]55DDYO  bB  C  	C  Cs   4A$&AA$c                 *  K   t        j                  |j                               }|j                  t	        dt
        j                        S t        j                  |j                  || j                         t	        dt
        j                        S wNz-1r   r   )r   r   r   corporate_idr   r	   CORPORATE_CONCEPT_OFFICE_NOTr   update_corporate_concept_officer   CORPORATE_CONCEPT_OFFICE_UPDATE)r   r    updated_corporate_concept_offices      r   r,   z=CorporateConceptOfficeService.update_corporate_concept_office   s     +E+T+TU\UgUgUi+j(+88@!x7\7\]]!AABbBoBo  rR  TX  T[  T[  	\S(2Z2Z[[s   BBc                    K   t        j                  || j                        }|st        dt        j
                        S t        dt        j                        S wr)   )r   delete_corporate_concept_officer   r   r	   r+   CORPORATE_CONCEPT_OFFICE_DELTE)r   r     deleted_corporate_concept_offices      r   r0   z=CorporateConceptOfficeService.delete_corporate_concept_office!   sJ     +D+d+demosovov+w(/!x7\7\]]S(2Y2YZZs   AAN)__name__
__module____qualname__r   r   r   r   CorporateConceptOfficeCreater   intr$   CorporateConceptOfficeUpdater,   r0    r   r   r   r   	   sZ    ' )9 UF<_<_ UC# C\F<_<_ \[S [r   r   N) app.api.corporate_concept_officer   (app.models.main.corporate_concept_officer   r   app.utils.schemas_utilsr   sqlalchemy.ormr   app.dependency.authanticationr   app.locale.messagesr	   fastapir
   r   r9   r   r   <module>rA      s&    3 j 2 " : ( ![ [r   