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

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', '0003_add_puck_email_template'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomEmailTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(help_text="Unique identifier for referencing in plugins (e.g., 'monthly-newsletter')", max_length=100)),
                ('name', models.CharField(help_text='Human-readable template name', max_length=255)),
                ('description', models.TextField(blank=True, help_text='Description of when/how this template is used')),
                ('subject_template', models.CharField(help_text='Email subject line. Supports all template 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')),
                ('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 this template', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_custom_email_templates', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['name'],
                'indexes': [models.Index(fields=['slug', 'is_active'], name='messaging_c_slug_a4d4d2_idx'), models.Index(fields=['created_at'], name='messaging_c_created_ffd80e_idx')],
                'constraints': [models.UniqueConstraint(fields=('slug',), name='unique_custom_template_slug_per_tenant')],
            },
        ),
    ]
