o
    dig                     @   sl   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 deZd	S )
    status)IsAuthenticatedIsAdminUser)Response)APIView)User)modelsc                   @   s&   e Zd ZdZeefZdgZdd ZdS )DashboardCountAPIViewap  
    A view for retrieving counts of various entities for the dashboard.

    Permissions:
    - Requires the user to be authenticated and have admin privileges.

    HTTP Methods:
    - GET: Retrieves counts of stations, amenities, connectors, locations,
           network operators, and users.

    Returns:
    A JSON response with counts of various entities.
    getc                 O   s   t jjjdd jdd}tj }tjj }tj	j }tj
j }tjj }	| | | | |	 | d}
t|
tjdS )NT)is_verifiedF)is_rejected)stations	amenities
connectors	locationsnetwork_operatorsusersr   )station_modelsStationMasterobjectsfilterannotate_is_rejected_stationr   allmaster_modelsAmenitiesMasterConnectorMasterLocationMasterNetworkOperatorMastercountr   r   HTTP_200_OK)selfrequestargskwargsr   r   r   r   r   r   response r&   \/var/www/html/evchargy.com/django-station-ev/station_ev/apps/master/views/dashboard_views.pyr      s$   

zDashboardCountAPIView.getN)	__name__
__module____qualname____doc__r   r   permission_classeshttp_method_namesr   r&   r&   r&   r'   r
      s
    r
   N)rest_frameworkr   Zrest_framework.permissionsr   r   rest_framework.responser   rest_framework.viewsr   Zapps.account.modelsr   Zapps.masterr	   r   Zapps.stationr   r
   r&   r&   r&   r'   <module>   s    