# Generated by Django 5.2.17 on 2026-10-16 04:17

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


class Migration(migrations.Migration):

    dependencies = [
        ('academy', '0011_discipline_delegation_settings'),
        ('discipline', '0004_academy_pin_attempt'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ViolationAlert',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('source', models.CharField(db_index=True, max_length=60)),
                ('signal', models.CharField(db_index=True, max_length=60)),
                ('alert_class', models.CharField(choices=[('INFO', 'Info'), ('NOTICE', 'Notice'), ('WARNING', 'Warning'), ('CRITICAL', 'Critical')], default='WARNING', max_length=10)),
                ('evidence', models.JSONField(blank=True, default=dict)),
                ('context', models.TextField(blank=True, default='')),
                ('confidence', models.CharField(blank=True, default='medium', max_length=10)),
                ('recommended', models.CharField(blank=True, default='', max_length=200)),
                ('action_url', models.CharField(blank=True, default='', max_length=400)),
                ('status', models.CharField(choices=[('OPEN', 'Open'), ('APPROVED', 'Approved'), ('REJECTED', 'Rejected'), ('DISMISSED', 'Dismissed'), ('ESCALATED', 'Escalated'), ('EXPIRED', 'Expired')], db_index=True, default='OPEN', max_length=10)),
                ('action_at', models.DateTimeField(blank=True, null=True)),
                ('action_reason', models.TextField(blank=True, default='')),
                ('expires_at', models.DateTimeField(blank=True, null=True)),
                ('expiry_action', models.CharField(blank=True, default='', max_length=40)),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('action_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('student', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='violation_alerts', to='academy.academystudent')),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['status', 'created_at'], name='discipline__status_be07b5_idx'), models.Index(fields=['alert_class', 'status'], name='discipline__alert_c_d08614_idx')],
            },
        ),
    ]
