
    
FZj                     h     G d  d      Z  ed      Z G d d      Z G d de      Z G d de      Zy	)
c                       e Zd ZdefdZy)	DaasErrorerrorc                     || _         | j                   d   | _        | j                   d   | _        | j                   d   | _        y )Ncodedomainmessage)r   r   r   r   )selfr   s     cC:\Users\Rodrigo\frota-trucks-cliente\python\Lib\site-packages\mygeotab/altitude/daas_definition.py__init__zDaasError.__init__   s9    
JJv&	jj*zz),    N)__name__
__module____qualname__dictr    r   r
   r   r      s    -d -r   r   zDapi return did not have all expected attributes, please retry again.c                       e Zd ZdZdefdZy)
DaasResulta  DaasResult class, the base class for all results returned from calling our application from the gateway

    Attributes:
        call_result (dict):                 The result returned from the api call, this includes our gateway information.
        api_result (dict):                  The "apiResult" the result computed by altitude application.
        jobs (list):                        all the possible results returned by the altitude application call, normally it should always have the length of 1.
        job (dict):                         first result returned by the altitude application call (first element of jobs).
        daas_errors (list):                 possible errors list that happened on the gateway.
        api_result_errors  (list):          possible errors list that happened on the altitude application.
        api_result_error_message (str):     possible single error message that happened on the altitude application.
        api_result_error  (DaasError):      possible single error object that happened on the altitude application.
        errors (list):                      list of all the errors (gateway and altitude application) combined together.
    call_resultc                    |st        d      t        g| _        t        || _        | j                  j	                  dg       D cg c]  }t        |       c}| _        | j                  D cg c]  }t        |j                         c}| _        d|vr*| xj                  t        d      t        gz  c_        t        | j                  d   | _        | j                  d   | _	        | j                  d   | _
        | j                  j	                  dg       D cg c]  }t        |       c}| _        | j                  j	                  dd       | _        d | _        | xj                  | j                  D cg c]  }t        |j                         c}z  c_        d| j                  v r_| j                  d   rPt        | j                  d         | _        | xj                  t        | j                  j                        gz  c_        | j                  rYt        | j                  t              r?t!        | j                        r*| xj                  t        | j                        gz  c_        y | j                  rHt        | j                  t"              r-| xj                  t        | j                  d	         gz  c_        y y y c c}w c c}w c c}w c c}w )
Nzresult is emptyerrors	apiResultzapiResult not presentresults    errorMessager   r   )	ExceptionNOT_FULL_API_CALL_EXCEPTIONr   r   getr   daas_errorsr   
api_resultjobsjobapi_result_errorsapi_result_error_messageapi_result_error
isinstancestrlenr   )r	   r   r   s      r
   r   zDaasResult.__init__   sD   $%679TUDK--&:>:J:J:N:NxY[:\]:\Ie,:\]=A=M=MN=MEy/=MNk)KKI&=>@[\\K--**;7OOI.	99Q<@D@S@ST\^`@a!b@au)E"2@a!b(,(;(;ND(Q% $d>T>TU>TU	%--0>TUUdoo%$//'*B$-doog.F$GD!KKId&;&;&C&CDEEK ))488#>D112KKId&C&CDEEK**z$:W:WY]/^KKId&C&CI&NOPPK 0_*7 ^N "c Vs   K,KK4KN)r   r   r   __doc__r   r   r   r   r
   r   r      s    #QD #Qr   r   c                   .     e Zd ZdZdef fdZd Z xZS )DaasGetJobStatusResulta  DaasGetJobStatusResult class, the returned format for checking the status of the job

    Attributes:
        id (str):           the id of the job returned
        status (dict):      the status of the job
        state (str):        the state of the job (from the status object)
    r   c                     t         |   |       | j                  d   | _        | j                  j	                  dddi      | _        | j
                  j	                  dd      | _        y )NidstatusstateFAILED)superr   r!   r,   r   r-   r.   r	   r   	__class__s     r
   r   zDaasGetJobStatusResult.__init__J   sP    %((4.hhll8gx-@A[[__Wh7
r   c                     | j                   dk(  ry| j                   dk7  ry| j                   dk(  r%| j                  rt        | j                        dkD  ryt        d      )NDONETr/   Fr   z4got to failed state with no error, please reach out.)r.   r   r'   r   )r	   s    r
   has_finishedz#DaasGetJobStatusResult.has_finishedP   sQ    ::ZZ8#ZZ8#DKK8H18LRSSr   )r   r   r   r(   r   r   r5   __classcell__r2   s   @r
   r*   r*   A   s    8D 8Tr   r*   c                   (     e Zd ZdZdef fdZ xZS )DaasGetQueryResulta  DaasGetQueryResult class, the returned format for checking the result of the job

    Attributes:
        totalRows (str):            the id of the job returned
        rows (list):                the rows including the data
        pageToken (str):            the token of the page
    r   c                     t         |   |       | j                  j                  dd       | _        | j                  j                  dd       | _        | j                  j                  dd       | _        y )N	totalRowsrows	pageToken)r0   r   r!   r   
total_rowsr<   
page_tokenr1   s     r
   r   zDaasGetQueryResult.__init__d   sR    %((,,{D9HHLL.	((,,{D9r   )r   r   r   r(   r   r   r6   r7   s   @r
   r9   r9   [   s    :D : :r   r9   N)r   r   r   r   r*   r9   r   r   r
   <module>r@      sD   - - ((no 2Q 2QjTZ T4: :r   