# Generated by Django 4.2.27 on 2026-01-23 22:01

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("eveonline", "0017_alliance_and_corp_names_are_not_unique"),
        ("eveuniverse", "0011_extend_industry_activites"),
    ]

    operations = [
        migrations.CreateModel(
            name="Campaign",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255)),
                ("description", models.TextField(blank=True)),
                ("start_date", models.DateTimeField()),
                ("end_date", models.DateTimeField(blank=True, null=True)),
                ("is_active", models.BooleanField(default=True)),
                (
                    "constellations",
                    models.ManyToManyField(blank=True, related_name="campaigns", to="eveuniverse.eveconstellation"),
                ),
                ("regions", models.ManyToManyField(blank=True, related_name="campaigns", to="eveuniverse.everegion")),
                (
                    "systems",
                    models.ManyToManyField(blank=True, related_name="campaigns", to="eveuniverse.evesolarsystem"),
                ),
            ],
            options={
                "permissions": (("basic_access", "Can access this app"), ("manage_campaign", "Can manage campaigns")),
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CampaignTarget",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "alliance",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="eveonline.eveallianceinfo",
                    ),
                ),
                (
                    "campaign",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="targets", to="aatps.campaign"
                    ),
                ),
                (
                    "character",
                    models.ForeignKey(
                        blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to="eveonline.evecharacter"
                    ),
                ),
                (
                    "corporation",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="eveonline.evecorporationinfo",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="CampaignMember",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "alliance",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="eveonline.eveallianceinfo",
                    ),
                ),
                (
                    "campaign",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="members", to="aatps.campaign"
                    ),
                ),
                (
                    "character",
                    models.ForeignKey(
                        blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to="eveonline.evecharacter"
                    ),
                ),
                (
                    "corporation",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="eveonline.evecorporationinfo",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="CampaignKillmail",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("killmail_id", models.BigIntegerField()),
                ("killmail_time", models.DateTimeField()),
                ("victim_id", models.BigIntegerField()),
                ("victim_name", models.CharField(max_length=255)),
                ("victim_corp_id", models.BigIntegerField()),
                ("victim_corp_name", models.CharField(max_length=255)),
                ("victim_alliance_id", models.BigIntegerField(blank=True, null=True)),
                ("victim_alliance_name", models.CharField(blank=True, max_length=255)),
                ("total_value", models.DecimalField(decimal_places=2, max_digits=20)),
                ("is_loss", models.BooleanField(default=False)),
                ("attackers", models.ManyToManyField(related_name="campaign_killmails", to="eveonline.evecharacter")),
                (
                    "campaign",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="killmails", to="aatps.campaign"
                    ),
                ),
                (
                    "solar_system",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="eveuniverse.evesolarsystem"
                    ),
                ),
            ],
            options={
                "unique_together": {("campaign", "killmail_id")},
            },
        ),
    ]
