# Generated by Django 4.2.23 on 2025-09-12 17:33

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


class Migration(migrations.Migration):

    initial = True

    operations = [
        migrations.CreateModel(
            name='OrgFilter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='Default', max_length=100)),
                ('alliance_ids', models.JSONField(blank=True, default=list)),
                ('corporation_ids', models.JSONField(blank=True, default=list)),
                ('is_default', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='PenaltyScheme',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True)),
                ('per_wrong_module_pct', models.DecimalField(decimal_places=2, default=Decimal('10.00'), max_digits=5)),
                ('per_missing_module_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('per_extra_module_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('count_rigs', models.BooleanField(default=True)),
                ('count_subsystems', models.BooleanField(default=True)),
                ('relax_substitutions_no_penalty', models.BooleanField(default=True)),
                ('max_total_deduction_pct', models.DecimalField(decimal_places=2, default=Decimal('50.00'), max_digits=5)),
                ('is_default', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='Submission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('systems', models.JSONField()),
                ('doctrine_id', models.PositiveIntegerField()),
                ('start_at', models.DateTimeField()),
                ('duration_minutes', models.PositiveIntegerField(default=120)),
                ('strict_mode', models.BooleanField(default=True)),
                ('status', models.CharField(default='queued', max_length=20)),
                ('error', models.TextField(blank=True, default='')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('processed_at', models.DateTimeField(blank=True, null=True)),
                ('fc', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
                ('org_filter', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='autosrp.orgfilter')),
            ],
            options={
                'permissions': [('manage', 'Can manage Auto SRP settings'), ('submit', 'Can submit Auto SRP requests'), ('review', 'Can review Auto SRP batches')],
            },
        ),
        migrations.CreateModel(
            name='KillRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('killmail_id', models.BigIntegerField(unique=True)),
                ('killmail_hash', models.CharField(max_length=64)),
                ('zkb_url', models.URLField()),
                ('occurred_at', models.DateTimeField()),
                ('system_id', models.BigIntegerField()),
                ('victim_char_id', models.BigIntegerField()),
                ('victim_corp_id', models.BigIntegerField()),
                ('victim_alliance_id', models.BigIntegerField(null=True)),
                ('ship_type_id', models.BigIntegerField()),
                ('fitted_type_ids', models.JSONField(default=list)),
                ('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='kills', to='autosrp.submission')),
                ('status', models.CharField(choices=[('submitted', 'Submitted'), ('approved', 'Approved'), ('approved_with_comment', 'Approved with Comment'), ('rejected', 'Rejected')], default='submitted', max_length=21)),
                ('status_comment', models.TextField(blank=True, default='')),
                ('reviewed_at', models.DateTimeField(blank=True, null=True)),
                ('reviewer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ItemPrices',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('buy', models.DecimalField(decimal_places=2, max_digits=20)),
                ('sell', models.DecimalField(decimal_places=2, max_digits=20)),
                ('updated', models.DateTimeField()),
                ('eve_type', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_related', related_query_name='%(app_label)s_%(class)s', to='eveuniverse.evetype')),
            ],
        ),
        migrations.CreateModel(
            name='FitCheck',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('doctrine_fit_id', models.PositiveIntegerField()),
                ('mode', models.CharField(default='strict', max_length=12)),
                ('passed', models.BooleanField(default=False)),
                ('missing', models.JSONField(default=dict)),
                ('extra', models.JSONField(default=dict)),
                ('substitutions', models.JSONField(default=list)),
                ('notes', models.TextField(blank=True, default='')),
                ('kill', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='fitcheck', to='autosrp.killrecord')),
            ],
        ),
        migrations.CreateModel(
            name='DoctrineReward',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('doctrine_id', models.PositiveIntegerField(db_index=True)),
                ('ship_type_id', models.BigIntegerField(db_index=True)),
                ('base_reward_isk', models.DecimalField(decimal_places=2, max_digits=18)),
                ('notes', models.CharField(blank=True, default='', max_length=200)),
                ('penalty_scheme', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='autosrp.penaltyscheme')),
            ],
            options={
                'unique_together': {('doctrine_id', 'ship_type_id')},
            },
        ),
        migrations.CreateModel(
            name='PayoutRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('suggested_isk', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('actual_isk', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('system_id', models.BigIntegerField(default=0)),
                ('system_name', models.CharField(blank=True, default='', max_length=120)),
                ('kill', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payout_record', to='autosrp.killrecord')),
            ],
        ),
        migrations.CreateModel(
            name='PayoutSuggestion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('base_reward_isk', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('penalty_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('penalty_breakdown', models.JSONField(default=dict)),
                ('suggested_isk', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('hull_price_isk', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('fit_price_isk', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('override_isk', models.DecimalField(blank=True, decimal_places=2, max_digits=18, null=True)),
                ('kill', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payout', to='autosrp.killrecord')),
            ],
        ),
        migrations.CreateModel(
            name='AppSetting',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True)),
                ('default_duration_minutes', models.PositiveIntegerField(default=120)),
                ('default_penalty_scheme', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='autosrp.penaltyscheme')),
                ('ignore_capsules', models.BooleanField(default=True, help_text='If enabled, kills where the victim was in a capsule are ignored.')),
            ],
        ),
        migrations.CreateModel(
            name='DiscordNotificationSetting',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('discord_enabled', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='discord_setting', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
