# Generated by Django 4.2 on 2026-01-28

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("eveonline", "0017_alliance_and_corp_names_are_not_unique"),
        ("aatps", "0005_campaign_last_run"),
    ]

    operations = [
        migrations.CreateModel(
            name="MonthlyKillmail",
            fields=[
                ("killmail_id", models.PositiveBigIntegerField(primary_key=True, serialize=False, unique=True)),
                ("killmail_time", models.DateTimeField(db_index=True)),
                ("solar_system_id", models.PositiveIntegerField()),
                ("solar_system_name", models.CharField(default="Unknown", max_length=255)),
                ("region_id", models.PositiveIntegerField(null=True)),
                ("region_name", models.CharField(default="Unknown", max_length=255)),
                ("ship_type_id", models.PositiveIntegerField(default=0)),
                ("ship_type_name", models.CharField(default="Unknown", max_length=255)),
                ("ship_group_name", models.CharField(default="Unknown", max_length=255)),
                ("victim_id", models.PositiveIntegerField(default=0)),
                ("victim_name", models.CharField(default="Unknown", max_length=255)),
                ("victim_corp_id", models.PositiveIntegerField(default=0)),
                ("victim_corp_name", models.CharField(default="Unknown", max_length=255)),
                ("victim_alliance_id", models.PositiveIntegerField(blank=True, null=True)),
                ("victim_alliance_name", models.CharField(blank=True, max_length=255, null=True)),
                ("final_blow_char_id", models.PositiveIntegerField(default=0)),
                ("final_blow_char_name", models.CharField(default="Unknown", max_length=255)),
                ("final_blow_corp_id", models.PositiveIntegerField(default=0)),
                ("final_blow_corp_name", models.CharField(default="Unknown", max_length=255)),
                ("final_blow_alliance_id", models.PositiveIntegerField(blank=True, null=True)),
                ("final_blow_alliance_name", models.CharField(blank=True, max_length=255, null=True)),
                ("total_value", models.DecimalField(decimal_places=2, default=0, max_digits=20)),
                ("zkill_hash", models.CharField(default="", max_length=64)),
            ],
        ),
        migrations.CreateModel(
            name="KillmailParticipant",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("is_victim", models.BooleanField(default=False)),
                ("is_final_blow", models.BooleanField(default=False)),
                ("damage_done", models.PositiveIntegerField(default=0)),
                ("ship_type_id", models.PositiveIntegerField(default=0)),
                ("ship_type_name", models.CharField(default="Unknown", max_length=255)),
                (
                    "character",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="eveonline.evecharacter"),
                ),
                (
                    "killmail",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="participants",
                        to="aatps.monthlykillmail",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
            options={
                "unique_together": {("killmail", "character")},
            },
        ),
    ]
