# Generated by Django 4.2 on 2023-04-21 23:07

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


class Migration(migrations.Migration):

    dependencies = [
        ('tom_nonlocalizedevents', '0015_eventsequence_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='ExternalCoincidence',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('details', models.JSONField(blank=True, help_text='Contains the payload of the external coincidence section of the alert', null=True)),
            ],
        ),
        migrations.AlterModelOptions(
            name='eventsequence',
            options={'ordering': ['sequence_id']},
        ),
        migrations.RemoveConstraint(
            model_name='eventlocalization',
            name='unique_date_per_nonlocalizedevent',
        ),
        migrations.RemoveField(
            model_name='eventlocalization',
            name='skymap_moc_file_url',
        ),
        migrations.AddField(
            model_name='eventlocalization',
            name='area_50',
            field=models.FloatField(blank=True, help_text='The 50 percent confidence region area', null=True),
        ),
        migrations.AddField(
            model_name='eventlocalization',
            name='area_90',
            field=models.FloatField(blank=True, help_text='The 90 percent confidence region area', null=True),
        ),
        migrations.AddField(
            model_name='eventlocalization',
            name='skymap_hash',
            field=models.UUIDField(blank=True, help_text='A UUID from an md5 hash of the raw skymap file contents, used to detect when it has changed', null=True),
        ),
        migrations.AddField(
            model_name='eventlocalization',
            name='skymap_url',
            field=models.URLField(default='', help_text='The URL to a file containing skymap file for used to generate this localization.'),
        ),
        migrations.AddField(
            model_name='eventlocalization',
            name='skymap_version',
            field=models.PositiveSmallIntegerField(blank=True, help_text='The version of the skymap for this localization', null=True),
        ),
        migrations.AddField(
            model_name='eventsequence',
            name='details',
            field=models.JSONField(blank=True, help_text='Contains the payload of the event section of the alert', null=True),
        ),
        migrations.AddField(
            model_name='eventsequence',
            name='ingestor_source',
            field=models.CharField(default='', help_text='The source of this alert - i.e. which stream is it from?'),
        ),
        migrations.AlterField(
            model_name='eventcandidate',
            name='priority',
            field=models.IntegerField(default=1, help_text='Internal priority of this Event Candidate'),
        ),
        migrations.AddConstraint(
            model_name='eventlocalization',
            constraint=models.UniqueConstraint(fields=('nonlocalizedevent', 'skymap_hash'), name='unique_skymap_per_nonlocalizedevent'),
        ),
        migrations.AddField(
            model_name='externalcoincidence',
            name='localization',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='external_coincidences', to='tom_nonlocalizedevents.eventlocalization'),
        ),
        migrations.AddField(
            model_name='eventsequence',
            name='external_coincidence',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sequences', to='tom_nonlocalizedevents.externalcoincidence'),
        ),
    ]
