# Generated by Django 4.2.11 on 2024-05-16 12:14

import django.core.validators
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", "0010_alter_eveindustryactivityduration_eve_type_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="General",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
            ],
            options={
                "permissions": (
                    ("basic_access", "Can access this app, Ledger."),
                    ("moderator_access", "Has access to moderation tools"),
                    ("admin_access", "Has access to all Administration tools"),
                ),
                "managed": False,
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CharacterAudit",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("active", models.BooleanField(default=False)),
                (
                    "last_update_wallet",
                    models.DateTimeField(blank=True, default=None, null=True),
                ),
                (
                    "last_update_mining",
                    models.DateTimeField(blank=True, default=None, null=True),
                ),
                (
                    "balance",
                    models.DecimalField(
                        decimal_places=2, default=None, max_digits=20, null=True
                    ),
                ),
                (
                    "character",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ledger_character",
                        to="eveonline.evecharacter",
                    ),
                ),
            ],
            options={
                "permissions": (
                    ("char_audit_admin_access", "Has access to all characters"),
                ),
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CorporationAudit",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "last_update_wallet",
                    models.DateTimeField(blank=True, default=None, null=True),
                ),
                (
                    "corporation",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ledger_corporationaudit",
                        to="eveonline.evecorporationinfo",
                    ),
                ),
            ],
            options={
                "permissions": (
                    ("corp_audit_admin_access", "Has access to all Corporations"),
                ),
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CorporationWalletDivision",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(default=None, max_length=100, null=True)),
                ("balance", models.DecimalField(decimal_places=2, max_digits=20)),
                ("division", models.IntegerField()),
                (
                    "corporation",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ledger_corporation_division",
                        to="ledger.corporationaudit",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CorpSteuer",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("character_id", models.PositiveIntegerField(null=True)),
                ("character_name", models.CharField(max_length=100, null=True)),
                ("status", models.CharField(blank=True, max_length=50, null=True)),
                ("date", models.DateField(blank=True, null=True)),
            ],
            options={
                "permissions": (
                    ("steuer_admin_access", "Has access to Tax Administration"),
                ),
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Events",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("title", models.CharField(max_length=100, null=True)),
                ("date_start", models.DateTimeField(blank=True, null=True)),
                ("date_end", models.DateTimeField(blank=True, null=True)),
                ("description", models.TextField(blank=True, null=True)),
                ("char_ledger", models.BooleanField(default=False, null=True)),
                ("location", models.CharField(blank=True, max_length=100, null=True)),
            ],
            options={
                "verbose_name": "event",
                "verbose_name_plural": "events",
                "permissions": (("event_admin_access", "Can access Events Tools"),),
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="EveEntity",
            fields=[
                (
                    "eve_id",
                    models.IntegerField(
                        primary_key=True,
                        serialize=False,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="id",
                    ),
                ),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("alliance", "Alliance"),
                            ("corporation", "Corporation"),
                            ("character", "Character"),
                        ],
                        max_length=32,
                        verbose_name="category",
                    ),
                ),
                ("name", models.CharField(max_length=254, verbose_name="name")),
                ("last_update", models.DateTimeField(auto_now=True)),
                (
                    "alliance",
                    models.ForeignKey(
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="alli",
                        to="ledger.eveentity",
                    ),
                ),
                (
                    "corporation",
                    models.ForeignKey(
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="corp",
                        to="ledger.eveentity",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CharacterMiningLedger",
            fields=[
                (
                    "id",
                    models.CharField(max_length=50, primary_key=True, serialize=False),
                ),
                ("date", models.DateField()),
                ("quantity", models.IntegerField()),
                (
                    "character",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ledger_character",
                        to="ledger.characteraudit",
                    ),
                ),
                (
                    "system",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ledger_evesolarsystem",
                        to="eveuniverse.evesolarsystem",
                    ),
                ),
                (
                    "type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ledger_evetype",
                        to="eveuniverse.evetype",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CorporationWalletJournalEntry",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=2, default=None, max_digits=20, null=True
                    ),
                ),
                (
                    "balance",
                    models.DecimalField(
                        decimal_places=2, default=None, max_digits=20, null=True
                    ),
                ),
                ("context_id", models.BigIntegerField(default=None, null=True)),
                (
                    "context_id_type",
                    models.CharField(
                        choices=[
                            ("structure_id", "Structure Id"),
                            ("station_id", "Station Id"),
                            ("market_transaction_id", "Market Transaction Id"),
                            ("character_id", "Character Id"),
                            ("corporation_id", "Corporation Id"),
                            ("alliance_id", "Alliance Id"),
                            ("eve_system", "Eve System"),
                            ("industry_job_id", "Industry Job Id"),
                            ("contract_id", "Contract Id"),
                            ("planet_id", "Planet Id"),
                            ("system_id", "System Id"),
                            ("type_id", "Type Id"),
                        ],
                        default=None,
                        max_length=30,
                        null=True,
                    ),
                ),
                ("date", models.DateTimeField()),
                ("description", models.CharField(max_length=500)),
                ("entry_id", models.BigIntegerField()),
                ("reason", models.CharField(default=None, max_length=500, null=True)),
                ("ref_type", models.CharField(max_length=72)),
                (
                    "tax",
                    models.DecimalField(
                        decimal_places=2, default=None, max_digits=20, null=True
                    ),
                ),
                ("tax_receiver_id", models.IntegerField(default=None, null=True)),
                (
                    "division",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ledger.corporationwalletdivision",
                    ),
                ),
                (
                    "first_party",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_DEFAULT,
                        related_name="+",
                        to="ledger.eveentity",
                    ),
                ),
                (
                    "second_party",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_DEFAULT,
                        related_name="+",
                        to="ledger.eveentity",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "default_permissions": (),
                "indexes": [
                    models.Index(fields=["date"], name="ledger_corp_date_c08a55_idx"),
                    models.Index(
                        fields=["amount"], name="ledger_corp_amount_e482ac_idx"
                    ),
                    models.Index(
                        fields=["entry_id"], name="ledger_corp_entry_i_e36818_idx"
                    ),
                    models.Index(
                        fields=["ref_type"], name="ledger_corp_ref_typ_280f5b_idx"
                    ),
                    models.Index(
                        fields=["first_party"], name="ledger_corp_first_p_114662_idx"
                    ),
                    models.Index(
                        fields=["second_party"], name="ledger_corp_second__9a820c_idx"
                    ),
                ],
            },
        ),
        migrations.CreateModel(
            name="CharacterWalletJournalEntry",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=2, default=None, max_digits=20, null=True
                    ),
                ),
                (
                    "balance",
                    models.DecimalField(
                        decimal_places=2, default=None, max_digits=20, null=True
                    ),
                ),
                ("context_id", models.BigIntegerField(default=None, null=True)),
                (
                    "context_id_type",
                    models.CharField(
                        choices=[
                            ("structure_id", "Structure Id"),
                            ("station_id", "Station Id"),
                            ("market_transaction_id", "Market Transaction Id"),
                            ("character_id", "Character Id"),
                            ("corporation_id", "Corporation Id"),
                            ("alliance_id", "Alliance Id"),
                            ("eve_system", "Eve System"),
                            ("industry_job_id", "Industry Job Id"),
                            ("contract_id", "Contract Id"),
                            ("planet_id", "Planet Id"),
                            ("system_id", "System Id"),
                            ("type_id", "Type Id"),
                        ],
                        default=None,
                        max_length=30,
                        null=True,
                    ),
                ),
                ("date", models.DateTimeField()),
                ("description", models.CharField(max_length=500)),
                ("entry_id", models.BigIntegerField()),
                ("reason", models.CharField(default=None, max_length=500, null=True)),
                ("ref_type", models.CharField(max_length=72)),
                (
                    "tax",
                    models.DecimalField(
                        decimal_places=2, default=None, max_digits=20, null=True
                    ),
                ),
                ("tax_receiver_id", models.IntegerField(default=None, null=True)),
                (
                    "character",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ledger.characteraudit",
                    ),
                ),
                (
                    "first_party",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_DEFAULT,
                        related_name="+",
                        to="ledger.eveentity",
                    ),
                ),
                (
                    "second_party",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_DEFAULT,
                        related_name="+",
                        to="ledger.eveentity",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "default_permissions": (),
                "indexes": [
                    models.Index(fields=["date"], name="ledger_char_date_e50f13_idx"),
                    models.Index(
                        fields=["amount"], name="ledger_char_amount_2c2575_idx"
                    ),
                    models.Index(
                        fields=["entry_id"], name="ledger_char_entry_i_8f5952_idx"
                    ),
                    models.Index(
                        fields=["ref_type"], name="ledger_char_ref_typ_f611b2_idx"
                    ),
                    models.Index(
                        fields=["first_party"], name="ledger_char_first_p_c0bd40_idx"
                    ),
                    models.Index(
                        fields=["second_party"], name="ledger_char_second__aa3ded_idx"
                    ),
                ],
            },
        ),
    ]
