o
    Nh                     @   s,   d dl mZ d dlmZ G dd deZdS )    )BaseCommand)NotificationTemplatec                   @   s   e Zd ZdZdd ZdS )Commandz,Set up default ticket notification templatesc           	      O   s  ddddddddd	dd
ddddddddddddddddddddddddg}d}d}|D ]J}t jj|d |d \}}|rU|d!7 }| j| jd"|j  q2|j|d# kr||d# |_|d$ |_	|
  |d!7 }| j| jd%|j  q2| j| jd&| d'|  d S )(NzTicket Assigned to Techniciansms_ticket_assignedzNew {{priority}} ticket {{ticket_id}} assigned to you: {{title}}. Customer: {{customer_name}}. Location: {{location}}. Scheduled: {{scheduled_date}}zCticket_id, title, customer_name, priority, scheduled_date, location)nametemplate_typecontentvariables_helpzAppointment Remindersms_appointment_reminderzReminder: Your {{service_type}} appointment is scheduled for {{scheduled_time}} today. Technician: {{technician_name}}. Ticket: {{ticket_id}}zGcustomer_name, ticket_id, scheduled_time, technician_name, service_typezAppointment Confirmedsms_appointment_confirmedzHello {{customer_name}}, your {{service_type}} appointment is confirmed for {{scheduled_date}} at {{scheduled_time}}. {{technician_name}} will visit {{location}}.zacustomer_name, ticket_id, scheduled_date, scheduled_time, service_type, technician_name, locationzTechnician Arrivingsms_technician_arrivingziHello {{customer_name}}, our technician {{technician_name}} is arriving shortly for ticket {{ticket_id}}.z)customer_name, technician_name, ticket_idzService Completedsms_service_completedzService completed! Ticket {{ticket_id}} for {{service_type}} has been resolved at {{completion_time}}. Thank you for choosing our services.z7customer_name, ticket_id, service_type, completion_timezTicket Overdue Alertsms_ticket_overduez[OVERDUE: Ticket {{ticket_id}} for {{customer_name}} is overdue by {{overdue_time}} minutes.z&ticket_id, customer_name, overdue_timezTicket Status Changesms_ticket_status_changez]Hello {{customer_name}}, your ticket {{ticket_id}} status has been updated to {{new_status}}.zHcustomer_name, ticket_id, old_status, new_status, title, assigned_personr   r   )r   defaults   zCreated template: r   r	   zUpdated template: z?Successfully processed ticket notification templates. Created: z, Updated: )r   objectsget_or_createstdoutwritestyleSUCCESSr   r   r	   saveWARNING)	selfargsoptions	templatescreated_countupdated_counttemplate_datatemplatecreated r#   X/var/www/html/optinet_system/notifications/management/commands/setup_ticket_templates.pyhandle   s   -


zCommand.handleN)__name__
__module____qualname__helpr%   r#   r#   r#   r$   r      s    r   N)django.core.management.baser   notifications.modelsr   r   r#   r#   r#   r$   <module>   s   