o
    Nh                     @   sd   d dl mZ d dlmZ d dlmZ e ZG dd dejZG dd dejZ	G dd	 d	ejZ
d
S )    )models)get_user_model)timezonec                   @   s   e Zd Zg dZejddZejdeddZejdddd	Zej	d
dZ
ej	dddZejddZejddZejddZdd ZG dd dZdS )NotificationTemplate))sms_payment_receivedzSMS - Payment Received)sms_payment_pendingzSMS - Payment Pending)sms_invoice_createdzSMS - Invoice Created)email_payment_receivedzEmail - Payment Received)email_payment_pendingzEmail - Payment Pending)email_invoice_createdzEmail - Invoice Created)
sms_customzSMS - Custom)email_customzEmail - Custom)sms_ticket_assignedz"SMS - Ticket Assigned (Technician))sms_appointment_reminderzSMS - Appointment Reminder)sms_appointment_confirmedz&SMS - Appointment Confirmed (Customer))sms_technician_arrivingzSMS - Technician Arriving)sms_service_completedzSMS - Service Completed)sms_ticket_overduezSMS - Ticket Overdue Alert)sms_schedule_summaryzSMS - Daily Schedule Summary)sms_ticket_status_changezSMS - Ticket Status Change)email_ticket_assignedzEmail - Ticket Assigned)email_ticket_status_changezEmail - Ticket Status Changed   
max_length2   T)r   choicesunique   zFor email templates only)r   blank	help_textz$Use {{variable}} for dynamic content)r    z%Available variables for this template)r   r    default)auto_now_add)auto_nowc                 C   s   | j  d|   dS )Nz ())nameget_template_type_displayself r*   4/var/www/html/optinet_system/notifications/models.py__str__'   s   zNotificationTemplate.__str__c                   @   s   e Zd ZddgZdS )zNotificationTemplate.Metatemplate_typer&   N)__name__
__module____qualname__orderingr*   r*   r*   r+   Meta*   s    r2   N)r.   r/   r0   TEMPLATE_TYPESr   	CharFieldr&   r-   subject	TextFieldcontentvariables_helpBooleanField	is_activeDateTimeField
created_at
updated_atr,   r2   r*   r*   r*   r+   r      s    r   c                   @   s   e Zd Zg dZejddZejdddZe Z	ej
eejdddZejded	d
Zej
eejddddZejejdZejdddZejdddZejdddZejddddZejdddZG dd dZdd ZdS )SMSLog)pendingPending)sentSent)failedFailed)	delivered	Delivered   r   r   Tr   r   	on_deletenullr      r@   r   r   r"   sent_sms_logsrK   rL   r   related_namer!   rL   r   r   rL   r   r   r   rL   c                   @      e Zd ZdgZdZdZdS )zSMSLog.Meta-sent_atzSMS LogzSMS LogsNr.   r/   r0   r1   verbose_nameverbose_name_pluralr*   r*   r*   r+   r2   D       r2   c                 C      d| j  d| j S )NzSMS to  - )recipient_phonestatusr(   r*   r*   r+   r,   I      zSMSLog.__str__N)r.   r/   r0   STATUS_CHOICESr   r4   r]   recipient_namer6   message
ForeignKeyr   SET_NULLtemplate_usedr^   Usersent_byr;   r   nowsent_atdelivered_aterror_messagePositiveIntegerFieldcustomer_id
payment_id
invoice_idr2   r,   r*   r*   r*   r+   r>   -   s     r>   c                   @   s  e Zd Zg dZg dZe ZejdddZ	ejddZ
e Zejded	d
ZejeejdddZejdedd
ZejeejddddZejejdZejdddZejdddZejdddZejddddZejddddZejdddZG dd dZ dd Z!dS )EmailLogr?   ))customer_invitationzCustomer Invitation)employee_invitationzEmployee Invitation)password_resetzPassword Reset)
test_emailz
Test Email)invoicezInvoice Notification)systemzSystem Notification)generalGeneral)otherOtherr   TrI   i  r      ry   rN   rJ   rM   r@   sent_notification_emailsrP   r!   rR   rS   z(Employee ID if email is employee-related)rL   r   r    r   rT   c                   @   rU   )zEmailLog.MetarV   z	Email Logz
Email LogsNrW   r*   r*   r*   r+   r2   q   rZ   r2   c                 C   r[   )Nz	Email to r\   )recipient_emailr^   r(   r*   r*   r+   r,   v   r_   zEmailLog.__str__N)"r.   r/   r0   r`   EMAIL_TYPE_CHOICESr   
EmailFieldr}   r4   ra   r5   r6   rb   
email_typerc   r   rd   re   r^   rf   rg   r;   r   rh   ri   rj   rk   rl   rm   employee_idrn   ro   r2   r,   r*   r*   r*   r+   rp   L   s(    rp   N)	django.dbr   django.contrib.authr   django.utilsr   rf   Modelr   r>   rp   r*   r*   r*   r+   <module>   s    &