# Generated by Django 5.2.8 on 2025-11-29 04:24

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


class Migration(migrations.Migration):

    dependencies = [
        ('schedule', '0018_alter_plugininstallation_scheduled_task'),
    ]

    operations = [
        migrations.AlterField(
            model_name='event',
            name='status',
            field=models.CharField(choices=[('SCHEDULED', 'Scheduled'), ('CANCELED', 'Canceled'), ('COMPLETED', 'Completed'), ('PAID', 'Paid'), ('NOSHOW', 'No Show')], db_index=True, default='SCHEDULED', max_length=20),
        ),
        migrations.CreateModel(
            name='EventPlugin',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('trigger', models.CharField(choices=[('event_created', 'When Event is Created'), ('event_updated', 'When Event is Updated'), ('event_completed', 'When Event is Completed'), ('event_canceled', 'When Event is Canceled'), ('before_start', 'Before Event Starts'), ('after_end', 'After Event Ends')], default='event_created', help_text='When this plugin should execute', max_length=20)),
                ('is_active', models.BooleanField(default=True, help_text='Whether this plugin should run for this event')),
                ('execution_order', models.PositiveSmallIntegerField(default=0, help_text='Order of execution (lower numbers run first)')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='schedule.event')),
                ('plugin_installation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='schedule.plugininstallation')),
            ],
            options={
                'ordering': ['execution_order', 'created_at'],
                'unique_together': {('event', 'plugin_installation', 'trigger')},
            },
        ),
        migrations.AddField(
            model_name='event',
            name='plugins',
            field=models.ManyToManyField(blank=True, help_text='Plugins attached to this event for automation', related_name='events', through='schedule.EventPlugin', to='schedule.plugininstallation'),
        ),
    ]
