# Generated by Django 5.2.11 on 2026-03-12 19:47

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0020_threadaccess_starred_at_remove_thread_has_starred_remove_message_is_starred'),
    ]

    operations = [
        migrations.AddField(
            model_name='messagetemplate',
            name='metadata',
            field=models.JSONField(blank=True, default=dict, help_text='Extra configuration (used for autoreply schedule, etc.)'),
        ),
        migrations.AddField(
            model_name='messagetemplate',
            name='signature',
            field=models.ForeignKey(blank=True, help_text='Signature template to append when sending (only for autoreply type)', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='signed_templates', to='core.messagetemplate'),
        ),
        migrations.AlterField(
            model_name='messagetemplate',
            name='type',
            field=models.SmallIntegerField(choices=[(1, 'message'), (2, 'signature'), (3, 'autoreply')], default=1, help_text='Type of template (message, signature, autoreply)', verbose_name='type'),
        ),
        migrations.AddConstraint(
            model_name='messagetemplate',
            constraint=models.UniqueConstraint(condition=models.Q(('is_active', True), ('type', 3)), fields=('mailbox',), name='uniq_active_autoreply_per_mailbox'),
        ),
    ]
