o
    diW                     @   s<   d dl mZ d dlmZ G dd deZG dd deZdS )    )models)DynamicFieldsModelSerializerc                   @   s   e Zd ZdZG dd dZdS )StationSerializerz
    Serializer for the StationMaster model.

    This serializer handles fields 'id', 'name', and 'description'.
    'id' is read-only.
    c                   @   s   e Zd ZejZdZdZdS )zStationSerializer.Meta)idnamedescriptionr   N)__name__
__module____qualname__station_modelStationMastermodelfieldsread_only_fields r   r   q/var/www/html/evchargy.com/django-station-ev/station_ev/apps/station/serializers/station_rejection_serializers.pyMeta   s    r   N)r	   r
   r   __doc__r   r   r   r   r   r      s    r   c                       s:   e Zd ZdZedddZG dd dZ fddZ  ZS )	StationRejectionSerializera  
    Serializer for the RejectedStations model.

    This serializer handles fields 'id', 'station', 'user', 'reason', and 'station_data'.
    'id' is read-only.
    'station' is write-only.
    'station_data' is serialized using the StationSerializer.
    stationT)source	read_onlyc                   @   s&   e Zd ZejZdZdZdddiiZdS )zStationRejectionSerializer.Meta)r   r   userreasonstation_datar   r   
write_onlyTN)	r	   r
   r   r   RejectedStationsr   r   r   extra_kwargsr   r   r   r   r   $   s    r   c                    sh   t t| j|i | d|v r.d|d v r0|d d }d|jv r2tjjjdd| jd _	dS dS dS dS )z
        Custom initialization method.

        Modifies the queryset of the 'station' field based on the request data.
        contextrequestr   F)is_verifiedN)
superr   __init__datar   r   objectsfilterr   queryset)selfargskwargsr    	__class__r   r   r#   ,   s   
z#StationRejectionSerializer.__init__)	r	   r
   r   r   r   r   r   r#   __classcell__r   r   r+   r   r      s
    
r   N)apps.stationr   r   base.serializersr   r   r   r   r   r   r   <module>   s    