
    rbi                         d 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ed	
          Z G d ded	
          Z G d ded	
          Z	 G d d          Z
dS )uA   Weather observation Python model for the Météo-France REST API.    )datetime)Any)Dict)Optional)	TypedDictc                   Z    e Zd ZU dZeed<   eed<   eed<   eed<   eed<   eed<   eed<   d	S )
 ObservationDataPropertiesGriddedzNData structure of the observation gridded properties object from the REST API.timeT
wind_speedwind_direction	wind_iconweather_iconweather_descriptionN)__name__
__module____qualname____doc__str__annotations__floatint     q/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/meteofrance_api/model/observation.pyr	   r	   
   sc         XX
IIIHHHNNNr   r	   F)totalc                   (    e Zd ZU dZeed<   eed<   dS )ObservationDataPropertieszFData structure of the observation properties object from the REST API.timezonegriddedN)r   r   r   r   r   r   r	   r   r   r   r   r      s-         PPMMM------r   r   c                   L    e Zd ZU dZeed<   eeef         ed<   eed<   eed<   dS )ObservationDataz;Data structure of the observation object from the REST API.update_timegeometrytype
propertiesN)	r   r   r   r   r   r   r   r   r   r   r   r   r"   r"      sM         EE38n
III))))))r   r"   c                      e Zd ZdZdeddfdZedee         fd            Z	ede
fd            Zedee         fd            Zedee         fd	            Zedee         fd
            Zedee         fd            Zedee         fd            Zedee         fd            Zedee         fd            Zedee         fd            ZdefdZdS )ObservationuW  Class to access the results of an `observation` API request.

    Attributes:
            timezone: The observation timezone
            time: The time at which the observation was made
            temperature: The observed temperature (°C)
            wind_speed: The observed wind speed (km/h)
            wind_direction: The observed wind direction (°)
            wind_icon: An icon ID illustrating the observed wind direction
            weather_icon: An icon ID illustrating the observed weather condition
            weather_description: A description of the observed weather condition
    raw_datareturnNc                 <    |                     di           | _        dS )zInitialize an Observation object.

        Args:
                raw_data: A dictionary representing the JSON response from 'observation' REST
                        API request. The structure is described by the ObservationData class.
        r&   N)getr&   )selfr)   s     r   __init__zObservation.__init__4   s     #,,|R88r   c                 6    | j                             d          S )z!Returns the observation timezone.r   r&   r,   r-   s    r   r   zObservation.timezone=   s     "":...r   c                 8    | j                             di           S )z+Returns the observation gridded properties.r    r0   r1   s    r   _griddedzObservation._griddedB   s     ""9b111r   c                 6    | j                             d          S )3Returns the time at which the observation was made.r
   r3   r,   r1   s    r   time_as_stringzObservation.time_as_stringG   s     }  (((r   c                 B    | j         }|dnt          j        |d          S )r5   Nz%Y-%m-%dT%H:%M:%S.%f%z)r7   r   strptime)r-   r
   s     r   time_as_datetimezObservation.time_as_datetimeL   s*     "LDDh&7>V&W&W	
r   c                 6    | j                             d          S )u    Returns the observed temp (°C).r   r6   r1   s    r   temperaturezObservation.temperatureT   s     }  %%%r   c                 6    | j                             d          S )z'Returns the observed wind speed (km/h).r   r6   r1   s    r   r   zObservation.wind_speedY   s     }  ...r   c                 6    | j                             d          S )u)   Returns the observed wind direction (°).r   r6   r1   s    r   r   zObservation.wind_direction^   s     }  !1222r   c                 6    | j                             d          S )z<Returns an icon ID illustrating the observed wind direction.r   r6   r1   s    r   r   zObservation.wind_iconc   s     }  ---r   c                 6    | j                             d          S )z?Returns an icon ID illustrating the observed weather condition.r   r6   r1   s    r   r   zObservation.weather_iconh   s     }  000r   c                 6    | j                             d          S )z8Returns a description of the observed weather condition.r   r6   r1   s    r   r   zObservation.weather_descriptionm   s     }  !6777r   c                     d| j          d| j         d| j         d| j         d| j         d| j         d| j         d| j         d	S )
z,Returns a stringified version of the object.zObservation(	timezone=z,	time=z,	temperature=u   °C,	wind_speed=z km/h,	wind_direction=u   °,	wind_icon=z,	weather_icon=z,	weather_description=))r   r7   r<   r   r   r   r   r   r1   s    r   __repr__zObservation.__repr__r   s    		 	(	 	 !,	 	  ?		 	
  $2	 	 .	 	 ".	 	 %)$<	 	 		
r   )r   r   r   r   r"   r.   propertyr   r   r   r	   r3   r7   r   r:   r   r<   r   r   r   r   r   r   rD   r   r   r   r(   r(   &   s        9 9T 9 9 9 9 /(3- / / / X/ 2: 2 2 2 X2 ) ) ) ) X) 
(8"4 
 
 
 X
 &Xe_ & & & X& /HUO / / / X/ 3 3 3 3 X3 .8C= . . . X. 1hsm 1 1 1 X1 8Xc] 8 8 8 X8
# 
 
 
 
 
 
r   r(   N)r   r   typingr   r   r   r   r	   r   r"   r(   r   r   r   <module>rG      s4   G G                              	 	 	 	 	y 	 	 	 	. . . . .	 . . . .* * * * *iu * * * *Y
 Y
 Y
 Y
 Y
 Y
 Y
 Y
 Y
 Y
r   