
    ZThc                         d dl Z d dlmZmZ d dlmZmZmZ d dlmZ	 d dl
mZ d dlmZ ej                  ej                  ej                   ej"                  gZ G d d      Zy)	    N)Optionalcast)GetReportRequestGetReportResponseReportRuleStatus)Report)ReportServiceStub)SiftChannelc                   Z    e Zd ZU dZeed<   eed<   dedefdZde	fdZ
dd	ee   defd
Zy)ReportServicez'Service to track the status of reports.	report_id_report_stubchannelc                 2    t        |      | _        || _        y N)r	   r   r   )selfr   r   s      [/home/www/backend.miabetepe.com/venv/lib/python3.12/site-packages/sift_py/report/service.py__init__zReportService.__init__   s    -g6"    returnc                     t        | j                        }t        t        | j                  j                  |            }|j                  S )zgReturns the results of the report.

        Returns:
            Information about the report.
        )r   )r   r   r   r   r   	GetReportreport)r   reqress      r   get_resultszReportService.get_results   s:     8$d&7&7&A&A#&FGzzr   Ntimeoutc                 (   t        j                          }	 |t        j                          |z
  |kD  ry| j                         }t        |j                  D cg c]  }|j                  t
        v  c}      }|ryt        j                  d       yc c}w )zWaits until the report processing is complete or the timeout is reached.

        Args:
            timeout: Timeout to wait for the report to finish. Default is None.

        Returns:
            True if the report finished within the timeout.
        TF   )timer   all	summariesstatusNOT_RUNNING_STATUSsleep)r   r   
start_timeresultsummaryall_dones         r   wait_until_donezReportService.wait_until_done%   s~     YY[
"99;+g5 %%'FPVP`P`aWGNN.@@abH

1  bs   Br   )__name__
__module____qualname____doc__str__annotations__r	   r
   r   
Report_pb2r   r   floatboolr*    r   r   r   r      sF    1N### # #Z x $ r   r   )r    typingr   r   sift.reports.v1.reports_pb2r   r   r   r   r1    sift.reports.v1.reports_pb2_grpcr	   sift_py.grpc.transportr
   REPORT_RULE_STATUS_CANCELEDREPORT_RULE_STATUS_ERRORREPORT_RULE_STATUS_FAILEDREPORT_RULE_STATUS_FINISHEDr$   r   r4   r   r   <module>r=      sR     ! ] ] < > . 00--..00	 ) )r   