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

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

EVE_SDE_REGION_MODEL = getattr(
    settings, "AACAMPAIGN_SDE_REGION_MODEL", "eve_sde.Region"
)
EVE_SDE_CONSTELLATION_MODEL = getattr(
    settings, "AACAMPAIGN_SDE_CONSTELLATION_MODEL", "eve_sde.Constellation"
)
EVE_SDE_SOLAR_SYSTEM_MODEL = getattr(
    settings, "AACAMPAIGN_SDE_SOLAR_SYSTEM_MODEL", "eve_sde.SolarSystem"
)


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('eveonline', '0017_alliance_and_corp_names_are_not_unique'),
        migrations.swappable_dependency(EVE_SDE_REGION_MODEL),
        migrations.swappable_dependency(EVE_SDE_CONSTELLATION_MODEL),
        migrations.swappable_dependency(EVE_SDE_SOLAR_SYSTEM_MODEL),
    ]

    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=EVE_SDE_CONSTELLATION_MODEL)),
                ('regions', models.ManyToManyField(blank=True, related_name='campaigns', to=EVE_SDE_REGION_MODEL)),
                ('systems', models.ManyToManyField(blank=True, related_name='campaigns', to=EVE_SDE_SOLAR_SYSTEM_MODEL)),
            ],
            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='aacampaign.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='aacampaign.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='aacampaign.campaign')),
                ('solar_system', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=EVE_SDE_SOLAR_SYSTEM_MODEL)),
            ],
            options={
                'unique_together': {('campaign', 'killmail_id')},
            },
        ),
    ]
