# Generated by Django 4.2.29 on 2026-03-21 21:54

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


class Migration(migrations.Migration):

    replaces = [
        ("miningtaxes", "0001_initial"),
        ("miningtaxes", "0002_all_models"),
        ("miningtaxes", "0003_alter_general_options"),
        ("miningtaxes", "0004_settings_interest_rate_alter_settings_phrase"),
        ("miningtaxes", "0005_oreprices_raw_price_oreprices_refined_price_and_more"),
        ("miningtaxes", "0006_charactertaxcredits_credit_type"),
        ("miningtaxes", "0007_character_life_credits_character_life_taxes"),
        ("miningtaxes", "0008_character_monthly_credits_json_and_more"),
        ("miningtaxes", "0009_stats"),
        ("miningtaxes", "0010_stats_admin_get_all_activity_json"),
        ("miningtaxes", "0011_stats_curmonth_leadergraph"),
        ("miningtaxes", "0012_stats_user_mining_ledger_90day"),
        ("miningtaxes", "0013_refactor_tax_rates"),
        ("miningtaxes", "0014_alter_adminminingobslog_eve_solar_system_and_more"),
    ]

    initial = True

    dependencies = [
        ("eve_sde", "0018_blueprintactivity_blueprintactivityproduct_and_more"),
        ("eveonline", "0017_alliance_and_corp_names_are_not_unique"),
    ]

    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"),
                    (
                        "admin_access",
                        "Can set tax rates for groups and add accountant characters",
                    ),
                    ("auditor_access", "Can view all registered characters data"),
                ),
                "managed": False,
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="AdminCharacter",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                (
                    "eve_character",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="miningtaxes_admin_character",
                        to="eveonline.evecharacter",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="AdminMiningObservers",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("obs_id", models.BigIntegerField()),
                ("obs_type", models.CharField(max_length=32)),
                ("name", models.CharField(max_length=32)),
                ("sys_name", models.CharField(max_length=32)),
                (
                    "character",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="mining_obs",
                        to="miningtaxes.admincharacter",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Character",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                ("life_credits", models.FloatField(default=0.0)),
                ("life_taxes", models.FloatField(default=0.0)),
                ("monthly_mining_json", models.JSONField(default=None, null=True)),
                ("monthly_taxes_json", models.JSONField(default=None, null=True)),
                ("monthly_credits_json", models.JSONField(default=None, null=True)),
                (
                    "eve_character",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="miningtaxes_character",
                        to="eveonline.evecharacter",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Settings",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "phrase",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=10,
                        verbose_name="Keyword (case insensitive) that must be present in the donation reason to be counted. Leave blank/empty to count all donations regardless of reason.",
                    ),
                ),
                (
                    "interest_rate",
                    models.FloatField(
                        default=5.0,
                        verbose_name="Monthly interest rate (%) if taxes have not been paid",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Stats",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("admin_char_json", models.JSONField(default=None, null=True)),
                ("admin_main_json", models.JSONField(default=None, null=True)),
                ("ore_prices_json", models.JSONField(default=None, null=True)),
                ("admin_mining_by_sys_json", models.JSONField(default=None, null=True)),
                ("admin_tax_revenue_json", models.JSONField(default=None, null=True)),
                ("admin_month_json", models.JSONField(default=None, null=True)),
                ("admin_corp_ledger", models.JSONField(default=None, null=True)),
                (
                    "admin_corp_mining_history",
                    models.JSONField(default=None, null=True),
                ),
                ("leaderboards", models.JSONField(default=None, null=True)),
                (
                    "admin_get_all_activity_json",
                    models.JSONField(default=None, null=True),
                ),
                ("curmonth_leadergraph", models.JSONField(default=None, null=True)),
                ("user_mining_ledger_90day", models.JSONField(default=None, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="OrePrices",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("buy", models.FloatField()),
                ("sell", models.FloatField()),
                ("raw_price", models.FloatField(default=0.0)),
                ("refined_price", models.FloatField(default=0.0)),
                ("taxed_price", models.FloatField(default=0.0)),
                ("tax_rate", models.FloatField(default=10.0)),
                ("updated", models.DateTimeField()),
                (
                    "eve_type",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="eve_sde.itemtype",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="CharacterUpdateStatus",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "is_success",
                    models.BooleanField(db_index=True, default=None, null=True),
                ),
                ("content_hash_1", models.CharField(default="", max_length=32)),
                ("content_hash_2", models.CharField(default="", max_length=32)),
                ("content_hash_3", models.CharField(default="", max_length=32)),
                ("last_error_message", models.TextField()),
                (
                    "root_task_id",
                    models.CharField(
                        db_index=True,
                        default="",
                        help_text="ID of update_all_characters task that started this update",
                        max_length=36,
                    ),
                ),
                (
                    "parent_task_id",
                    models.CharField(
                        db_index=True,
                        default="",
                        help_text="ID of character_update task that started this update",
                        max_length=36,
                    ),
                ),
                (
                    "started_at",
                    models.DateTimeField(db_index=True, default=None, null=True),
                ),
                (
                    "finished_at",
                    models.DateTimeField(db_index=True, default=None, null=True),
                ),
                (
                    "character",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="update_status_set",
                        to="miningtaxes.character",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CharacterTaxCredits",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("date", models.DateTimeField(db_index=True)),
                ("credit", models.FloatField(default=0.0)),
                ("credit_type", models.CharField(default="", max_length=32)),
                (
                    "character",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="tax_credits",
                        to="miningtaxes.character",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="CharacterMiningLedgerEntry",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("date", models.DateField(db_index=True)),
                ("quantity", models.PositiveIntegerField()),
                ("raw_price", models.FloatField(default=0.0)),
                ("refined_price", models.FloatField(default=0.0)),
                ("taxed_value", models.FloatField(default=0.0)),
                ("taxes_owed", models.FloatField(default=0.0)),
                (
                    "character",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="mining_ledger",
                        to="miningtaxes.character",
                    ),
                ),
                (
                    "eve_solar_system",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="eve_sde.solarsystem",
                    ),
                ),
                (
                    "eve_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="eve_sde.itemtype",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="AdminMiningObsLog",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("date", models.DateField(db_index=True)),
                ("miner_id", models.BigIntegerField()),
                ("quantity", models.PositiveIntegerField()),
                ("observer_type", models.CharField(max_length=32)),
                (
                    "eve_solar_system",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="eve_sde.solarsystem",
                    ),
                ),
                (
                    "eve_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="eve_sde.itemtype",
                    ),
                ),
                (
                    "observer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="mining_log",
                        to="miningtaxes.adminminingobservers",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="AdminMiningCorpLedgerEntry",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("date", models.DateTimeField(db_index=True)),
                ("taxed_id", models.BigIntegerField()),
                ("amount", models.FloatField(default=0.0)),
                ("reason", models.CharField(max_length=32)),
                (
                    "character",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="corp_ledger",
                        to="miningtaxes.admincharacter",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.AddConstraint(
            model_name="characterupdatestatus",
            constraint=models.UniqueConstraint(
                fields=("character",),
                name="functional_pk_miningtaxes_charactersyncstatus",
            ),
        ),
        migrations.AddConstraint(
            model_name="charactertaxcredits",
            constraint=models.UniqueConstraint(
                fields=("character", "date", "credit"),
                name="functional_pk_miningtaxes_charactertaxes",
            ),
        ),
        migrations.AddConstraint(
            model_name="characterminingledgerentry",
            constraint=models.UniqueConstraint(
                fields=("character", "date", "eve_solar_system", "eve_type"),
                name="functional_pk_mt_characterminingledgerentry",
            ),
        ),
        migrations.AddConstraint(
            model_name="adminminingobslog",
            constraint=models.UniqueConstraint(
                fields=("observer", "date", "miner_id", "eve_type"),
                name="functional_pk_mt_adminMiningLog",
            ),
        ),
        migrations.AddConstraint(
            model_name="adminminingobservers",
            constraint=models.UniqueConstraint(
                fields=("obs_id",), name="functional_pk_mt_adminMiningObs"
            ),
        ),
        migrations.AddConstraint(
            model_name="adminminingcorpledgerentry",
            constraint=models.UniqueConstraint(
                fields=("character", "date", "taxed_id"),
                name="functional_pk_mt_admincorpledger",
            ),
        ),
    ]
