# Generated by Django 5.2.8 on 2025-12-14 01:38

import django.db.models.deletion
import smoothschedule.communication.messaging.models
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('messaging', '0002_add_broadcast_messaging'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='PuckEmailTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email_type', models.CharField(choices=[('welcome', 'Welcome'), ('appointment_confirmation', 'Appointment Confirmation'), ('appointment_reminder', 'Appointment Reminder'), ('appointment_rescheduled', 'Appointment Rescheduled'), ('appointment_cancelled', 'Appointment Cancelled'), ('thank_you', 'Thank You'), ('contract_signing_request', 'Contract Signing Request'), ('contract_reminder', 'Contract Reminder'), ('contract_signed', 'Contract Signed'), ('payment_receipt', 'Payment Receipt'), ('invoice', 'Invoice'), ('payment_reminder', 'Payment Reminder'), ('ticket_assigned', 'Ticket Assigned'), ('ticket_reply', 'Ticket Reply'), ('ticket_resolved', 'Ticket Resolved')], db_index=True, help_text='Type of email this template is for', max_length=50)),
                ('subject_template', models.CharField(help_text='Email subject line. Supports tags like {{ customer_name }}', max_length=500)),
                ('puck_data', models.JSONField(default=smoothschedule.communication.messaging.models.default_puck_data, help_text='Puck editor JSON data for email body')),
                ('is_active', models.BooleanField(db_index=True, default=True, help_text='Whether this template is active')),
                ('is_customized', models.BooleanField(default=False, help_text='Whether tenant has customized from default')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created/last edited this template', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_email_templates_puck', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['email_type'],
                'indexes': [models.Index(fields=['email_type', 'is_active'], name='messaging_p_email_t_ac2087_idx')],
                'constraints': [models.UniqueConstraint(fields=('email_type',), name='unique_email_type_per_tenant')],
            },
        ),
    ]
