# Generated by Django 5.2.8 on 2025-11-29 18:33

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('schedule', '0022_add_apply_to_existing_flag'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='EmailTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('subject', models.CharField(help_text='Email subject line - supports template variables like {{CUSTOMER_NAME}}', max_length=500)),
                ('html_content', models.TextField(blank=True, help_text='HTML email body')),
                ('text_content', models.TextField(blank=True, help_text='Plain text email body (fallback for non-HTML clients)')),
                ('scope', models.CharField(choices=[('BUSINESS', 'Business'), ('PLATFORM', 'Platform')], default='BUSINESS', max_length=20)),
                ('is_default', models.BooleanField(default=False, help_text='Default template for certain system triggers')),
                ('category', models.CharField(choices=[('APPOINTMENT', 'Appointment'), ('REMINDER', 'Reminder'), ('CONFIRMATION', 'Confirmation'), ('MARKETING', 'Marketing'), ('NOTIFICATION', 'Notification'), ('REPORT', 'Report'), ('OTHER', 'Other')], default='OTHER', max_length=50)),
                ('preview_context', models.JSONField(blank=True, default=dict, help_text='Sample data for rendering preview')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_email_templates', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['name'],
                'indexes': [models.Index(fields=['scope', 'category'], name='schedule_em_scope_e4cf94_idx')],
            },
        ),
    ]
