o
    fsi`
                     @   s   d dl mZ ddlmZmZ d dlmZ G dd dejZG dd dejZ	G d	d
 d
ejZ
G dd dejZG dd dejZdS )    )serializers   )RegistrationPaymentProof)EventListSerializerc                   @   s   e Zd ZG dd dZdS )PaymentProofSerializerc                   @       e Zd ZeZg dZg dZdS )zPaymentProofSerializer.Meta)idfileuploaded_atnotesreviewedreviewed_at)r   r   r   N)__name__
__module____qualname__r   modelfieldsread_only_fields r   r   D/var/www/html/smartRegister/backend/apps/registration/serializers.pyMeta       r   N)r   r   r   r   r   r   r   r   r      s    r   c                   @   sZ   e Zd ZejdddZedddZeddZ	ejdddZ
ejdddZG dd	 d	Zd
S )RegistrationSerializerz
event.nameT)source	read_onlyevent)r   get_status_displayget_payment_status_displayc                   @   r   )zRegistrationSerializer.Meta)r	   registration_code	full_nameemailphoneorganisationr   
event_nameevent_detailsstatusstatus_displaypayment_statuspayment_status_displayhas_attendedattendance_timestampr   payment_proofregistered_at
updated_at)r   r-   r.   r*   r+   Nr   r   r   r   r   r   r   r   r   r   r   r      s    r   N)r   r   r   r   	CharFieldr$   r   r%   r   r,   r'   r)   r   r   r   r   r   r      s    
r   c                   @   s&   e Zd ZdZG dd dZdd ZdS )PublicRegistrationSerializerzFSerializer for public-facing registration (no sensitive admin fields).c                   @   r   )z!PublicRegistrationSerializer.Meta)
r	   r   r    r!   r"   r#   r   r&   r(   r-   )r   r&   r(   r-   Nr/   r   r   r   r   r   #   r   r   c                 C   s:   |j r|jrtd|jstd|jrtd|S )NzThis event is no longer active.z(Registration is not open for this event.z(This event has reached maximum capacity.)	is_activeis_archivedr   ValidationErroris_registerableis_at_capacity)selfr   r   r   r   validate_event(   s   


z+PublicRegistrationSerializer.validate_eventN)r   r   r   __doc__r   r8   r   r   r   r   r1       s    r1   c                   @   s   e Zd ZejddZdS )VerifyCodeSerializer   )
max_lengthN)r   r   r   r   r0   r   r   r   r   r   r:   2   s    r:   c                   @   s,   e Zd ZejejddZejejddZ	dS )"UpdateRegistrationStatusSerializerF)choicesrequiredN)
r   r   r   r   ChoiceFieldr   STATUS_CHOICESr&   PAYMENT_STATUS_CHOICESr(   r   r   r   r   r=   6   s    r=   N)rest_frameworkr   modelsr   r   apps.events.serializersr   ModelSerializerr   r   r1   
Serializerr:   r=   r   r   r   r   <module>   s    