
    xh+                          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d
S )c                      e Zd ZdZ	 ddZd Zd Zed             Zej	        d             Zed             Z
e
j	        d	             Z
ed
             Zej	        d             Zed             Zej	        d             Zed             Zej	        d             Zed             Zej	        d             Zed             Zej	        d             ZdS )StatszP
    Object for building query params for a global email statistics request
    Nc                 ~    d| _         d| _        d| _        d| _        d| _        d| _        d| _        |r	|| _        dS dS )zCreate a Stats object

        :param start_date: Date of when stats should begin in YYYY-MM-DD format, defaults to None
        :type start_date: string, optional
        N)_start_date	_end_date_aggregated_by_sort_by_metric_sort_by_direction_limit_offset
start_date)selfr   s     O/var/www/html/what/lib/python3.11/site-packages/sendgrid/helpers/stats/stats.py__init__zStats.__init__   sX      "#"&  	)(DOOO	) 	)    c                 D    t          |                                           S )zJGet a JSON representation of this object.

        :rtype: string
        )strgetr   s    r   __str__zStats.__str__   s    
 488::r   c                     i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S )	z
        Get a JSON-ready representation of Stats

        :returns: This GlobalStats, ready for use in a request body.
        :rtype: response stats dict
        Nr   end_dateaggregated_bysort_by_metricsort_by_directionlimitoffset)r   r   r   r   r   r   r   r   statss     r   r   z	Stats.get   s     ?&"&/E,=$ $E*)%)%7E/"*&*&9E"#!-)-)?E%&:!!ZE'N;""kE(Or   c                     | j         S )zUDate of when stats should begin in YYYY-MM-DD format

        :rtype: string
        r   r   s    r   r   zStats.start_date7        r   c                     || _         dS )zDate of when stats should begin in YYYY-MM-DD format

        :param value: Date representing when stats should begin
        :type value: string
        Nr    r   values     r   r   zStats.start_date?   s     !r   c                     | j         S )zSDate of when stats should end in YYYY-MM-DD format

        :rtype: string
        r   r   s    r   r   zStats.end_dateH        ~r   c                     || _         dS )zDate of when stats should end in YYYY-MM-DD format

        :param value: Date representing when stats should end
        :type value: string
        Nr&   r#   s     r   r   zStats.end_dateP   s     r   c                     | j         S )zfChosen period (e.g. 'day', 'week', 'month') for how stats get grouped

        :rtype: string
        r   r   s    r   r   zStats.aggregated_byY   s     ""r   c                     || _         dS )zChosen period (e.g. 'day', 'week', 'month') for how stats get grouped

        :param value: Period for how keys will get formatted
        :type value: string
        Nr*   r#   s     r   r   zStats.aggregated_bya   s     $r   c                     | j         S )z8Metric to sort stats by

        :rtype: string
        r   r   s    r   r   zStats.sort_by_metricj   s     ##r   c                     || _         dS )zyMetric to sort stats by

        :param value: Chosen metric stats will by sorted by
        :type value: string
        Nr-   r#   s     r   r   zStats.sort_by_metricr   s      %r   c                     | j         S )zVDirection data will be sorted, either 'asc' or 'desc'

        :rtype: string
        r	   r   s    r   r   zStats.sort_by_direction{   s     &&r   c                     || _         dS )zDirection data will be sorted, either 'asc' or 'desc'

        :param value: Direction of data, either 'asc' or 'desc'
        :type value: string
        Nr0   r#   s     r   r   zStats.sort_by_direction   s     #(r   c                     | j         S )zBMax amount of results to be returned

        :rtype: int
        r
   r   s    r   r   zStats.limit   s     {r   c                     || _         dS )zsMax amount of results to be returned

        :param value: Max amount of results
        :type value: int
        Nr3   r#   s     r   r   zStats.limit   s     r   c                     | j         S )zWNumber of places a starting point of a data set will move

        :rtype: int
        r   r   s    r   r   zStats.offset   s     |r   c                     || _         dS )zNumber of places a starting point of a data set will move

        :param value: Number of positions to move from starting point
        :type value: int
        Nr6   r#   s     r   r   zStats.offset   s     r   N)__name__
__module____qualname____doc__r   r   r   propertyr   setterr   r   r   r   r   r    r   r   r   r      s         ") ) ) )&    0     X  ! ! !   X _  _ # # X# $ $ $ $ $ X$ % % % ' ' X' ( ( (   X \  \   X ]  ]  r   r   c                   F     e Zd ZdZd fd	Zd Zed             Zd Z xZ	S )CategoryStatszL
    object for building query params for a category statistics request
    Nc                     d| _         t          t          |                                            |r0|r0|| _        |D ](}|                     t          |                     %dS dS dS )a7  Create a CategoryStats object

        :param start_date: Date of when stats should begin in YYYY-MM-DD format, defaults to None
        :type start_date: string, optional
        :param categories: list of categories to get results of, defaults to None
        :type categories: list(string), optional
        N)_categoriessuperrA   r   r   add_categoryCategory)r   r   
categoriescat_name	__class__s       r   r   zCategoryStats.__init__   s      mT""++---  	6* 	6(DO& 6 6!!(8"4"45555	6 	6 	6 	66 6r   c                 .   i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        d	 | j        D             |d
<   |S )zw
        Get a JSON-ready representation of this CategoryStats.

        :return: response category stats dict
        Nr   r   r   r   r   r   r   c                 6    g | ]}|                                 S r?   r   ).0categorys     r   
<listcomp>z%CategoryStats.get.<locals>.<listcomp>   s,     #4 #4 #4h8<<>> #4 #4 #4r   rG   )r   r   r   r   r   r   r   rG   r   s     r   r   zCategoryStats.get   s     ?&"&/E,=$ $E*)%)%7E/"*&*&9E"#!-)-)?E%&:!!ZE'N;""kE(O?&#4 #4#'?#4 #4 #4E,r   c                     | j         S )z;List of categories

        :rtype: list(Category)
        )rC   r   s    r   rG   zCategoryStats.categories   r!   r   c                 V    | j         g | _         | j                             |           dS )zAppends a category to this object's category list

        :param category: Category to append to CategoryStats
        :type category: Category
        N)rC   append)r   rN   s     r   rE   zCategoryStats.add_category   s2     #!D)))))r   NN)
r9   r:   r;   r<   r   r   r=   rG   rE   __classcell__rI   s   @r   rA   rA      s         6 6 6 6 6 6"  4     X * * * * * * *r   rA   c                   F     e Zd ZdZd fd	Zd Zed             Zd Z xZ	S )SubuserStatszJ
    object of building query params for a subuser statistics request
    Nc                     d| _         t          t          |                                            |r0|r0|| _        |D ](}|                     t          |                     %dS dS dS )a0  Create a SubuserStats object

        :param start_date: Date of when stats should begin in YYYY-MM-DD format, defaults to None
        :type start_date: string, optional
        :param subusers: list of subusers to get results of, defaults to None
        :type subusers: list(string), optional
        N)	_subusersrD   rW   r   r   add_subuserSubuser)r   r   subuserssubuser_namerI   s       r   r   zSubuserStats.__init__   s     lD!!**,,,  	8( 	8(DO ( 8 8  !6!67777	8 	8 	8 	88 8r   c                 .   i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        d	 | j        D             |d
<   |S )zu
        Get a JSON-ready representation of this SubuserStats.

        :return: response subuser stats dict
        Nr   r   r   r   r   r   r   c                 6    g | ]}|                                 S r?   rL   )rM   subusers     r   rO   z$SubuserStats.get.<locals>.<listcomp>  s,     !0 !0 !07 !0 !0 !0r   r\   )r   r   r   r   r   r   r   r\   r   s     r   r   zSubuserStats.get  s     ?&"&/E,=$ $E*)%)%7E/"*&*&9E"#!-)-)?E%&:!!ZE'N;""kE(O=$!0 !0!%!0 !0 !0E*r   c                     | j         S )z8List of subusers

        :rtype: list(Subuser)
        )rY   r   s    r   r\   zSubuserStats.subusers   r'   r   c                 V    | j         g | _         | j                             |           dS )zAppends a subuser to this object's subuser list

        :param subuser: Subuser to append to SubuserStats
        :type subuser: Subuser
        N)rY   rR   )r   r`   s     r   rZ   zSubuserStats.add_subuser(  s/     >!DNg&&&&&r   rS   )
r9   r:   r;   r<   r   r   r=   r\   rZ   rT   rU   s   @r   rW   rW      s         8 8 8 8 8 8"  4   X' ' ' ' ' ' 'r   rW   c                   V    e Zd ZdZddZed             Zej        d             Zd ZdS )rF   zZ
    Represents a searchable statistics category to be used in a CategoryStats object
    Nc                 *    d| _         |	|| _         dS dS )zCreate a Category object

        :param name: name of category, defaults to None
        :type name: string, optional
        N_namer   names     r   r   zCategory.__init__7  $     
DJJJ r   c                     | j         S )z5Get name of category

        :rtype: string
        re   r   s    r   rh   zCategory.nameA       zr   c                     || _         dS )zqSet name of category

        :param value: name of the statistical category
        :type value: string
        Nre   r#   s     r   rh   zCategory.nameI       


r   c                     | j         S )zj
        Get a string representation of Category.

        :return: string of the category's name
        rh   r   s    r   r   zCategory.getR       yr   r8   	r9   r:   r;   r<   r   r=   rh   r>   r   r?   r   r   rF   rF   3  y               X 
[  [    r   rF   c                   V    e Zd ZdZddZed             Zej        d             Zd ZdS )r[   zM
    Represents a searchable subuser to be used in a SubuserStats object
    Nc                 *    d| _         |	|| _         dS dS )z}Create a Subuser object

        :param name: name of subuser, defaults to None
        :type name: string, optional
        Nre   rg   s     r   r   zSubuser.__init___  ri   r   c                     | j         S )z8Get name of the subuser

        :rtype: string
        re   r   s    r   rh   zSubuser.namei  rk   r   c                     || _         dS )zgSet name of the subuser

        :param value: name of the subuser
        :type value: string
        Nre   r#   s     r   rh   zSubuser.nameq  rm   r   c                     | j         S )zh
        Get a string representation of Subuser.

        :return: string of the subuser's name
        ro   r   s    r   r   zSubuser.getz  rp   r   r8   rq   r?   r   r   r[   r[   [  rr   r   r[   N)objectr   rA   rW   rF   r[   r?   r   r   <module>ry      s   k k k k kF k k k\?* ?* ?* ?* ?*E ?* ?* ?*D?' ?' ?' ?' ?'5 ?' ?' ?'D% % % % %v % % %P% % % % %f % % % % %r   