# Generated by Django 4.2.20 on 2025-05-19 06:52

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


class Migration(migrations.Migration):

    dependencies = [
        ("taxsystem", "0004_owneraudit_last_update_payday_and_more"),
    ]

    operations = [
        migrations.RenameField(
            model_name="corporationwalletdivision",
            old_name="division",
            new_name="division_id",
        ),
        migrations.RemoveField(
            model_name="owneraudit",
            name="last_update_members",
        ),
        migrations.RemoveField(
            model_name="owneraudit",
            name="last_update_payday",
        ),
        migrations.RemoveField(
            model_name="owneraudit",
            name="last_update_payment_system",
        ),
        migrations.RemoveField(
            model_name="owneraudit",
            name="last_update_payments",
        ),
        migrations.RemoveField(
            model_name="owneraudit",
            name="last_update_wallet",
        ),
        migrations.AlterField(
            model_name="corporationwalletdivision",
            name="corporation",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="ts_corporation_division",
                to="taxsystem.owneraudit",
            ),
        ),
        migrations.AlterField(
            model_name="members",
            name="corporation",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="ts_members",
                to="taxsystem.owneraudit",
            ),
        ),
        migrations.AlterField(
            model_name="owneraudit",
            name="active",
            field=models.BooleanField(default=True),
        ),
        migrations.AlterField(
            model_name="payments",
            name="account",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="ts_payments",
                to="taxsystem.paymentsystem",
            ),
        ),
        migrations.AlterField(
            model_name="paymentsystem",
            name="corporation",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="ts_payment_system",
                to="taxsystem.owneraudit",
            ),
        ),
        migrations.RenameField(
            model_name="members",
            old_name="corporation",
            new_name="owner",
        ),
        migrations.RenameField(
            model_name="paymentsystem",
            old_name="corporation",
            new_name="owner",
        ),
        migrations.RenameField(
            model_name="adminlogs",
            old_name="corporation",
            new_name="owner",
        ),
        migrations.RenameField(
            model_name="smartgroup",
            old_name="corporation",
            new_name="owner",
        ),
        migrations.AlterField(
            model_name="smartgroup",
            name="owner",
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="ts_filter_sets",
                to="taxsystem.owneraudit",
            ),
        ),
        migrations.AlterField(
            model_name="corporationwalletjournalentry",
            name="division",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="ts_corporation_wallet",
                to="taxsystem.corporationwalletdivision",
            ),
        ),
        migrations.CreateModel(
            name="OwnerUpdateStatus",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "section",
                    models.CharField(
                        choices=[
                            ("wallet", "Wallet Journal"),
                            ("division", "Wallet Division"),
                            ("members", "Members"),
                            ("payments", "Payments"),
                            ("payment_system", "Payment System"),
                            ("payday", "Payday"),
                        ],
                        db_index=True,
                        max_length=32,
                    ),
                ),
                (
                    "is_success",
                    models.BooleanField(db_index=True, default=None, null=True),
                ),
                ("error_message", models.TextField()),
                ("has_token_error", models.BooleanField(default=False)),
                (
                    "last_run_at",
                    models.DateTimeField(
                        db_index=True,
                        default=None,
                        help_text="Last run has been started at this time",
                        null=True,
                    ),
                ),
                (
                    "last_run_finished_at",
                    models.DateTimeField(
                        db_index=True,
                        default=None,
                        help_text="Last run has been successful finished at this time",
                        null=True,
                    ),
                ),
                (
                    "last_update_at",
                    models.DateTimeField(
                        db_index=True,
                        default=None,
                        help_text="Last update has been started at this time",
                        null=True,
                    ),
                ),
                (
                    "last_update_finished_at",
                    models.DateTimeField(
                        db_index=True,
                        default=None,
                        help_text="Last update has been successful finished at this time",
                        null=True,
                    ),
                ),
                (
                    "owner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ts_update_status",
                        to="taxsystem.owneraudit",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
    ]
