# Generated by Django 5.2.8 on 2025-12-10 10:23

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="AuditLog",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_by", models.TextField(blank=True, editable=False, null=True)),
                ("edited_by", models.TextField(blank=True, editable=False, null=True)),
                ("date", models.DateTimeField(auto_now_add=True)),
                ("author", models.CharField(max_length=255)),
                ("resource", models.CharField(max_length=255)),
                (
                    "action",
                    models.CharField(
                        choices=[
                            ("create", "Create"),
                            ("update", "Update"),
                            ("delete", "Delete"),
                        ],
                        max_length=10,
                    ),
                ),
                ("payload", models.JSONField(blank=True, null=True)),
                (
                    "calculation_id",
                    models.TextField(blank=True, default="test_id", null=True),
                ),
                ("object_id", models.PositiveIntegerField(blank=True, null=True)),
                (
                    "content_type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                    ),
                ),
            ],
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name="AuditLogStatus",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_by", models.TextField(blank=True, editable=False, null=True)),
                ("edited_by", models.TextField(blank=True, editable=False, null=True)),
                ("status", models.CharField(default="pending", max_length=20)),
                ("error_traceback", models.TextField(blank=True, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "audit_log",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="status_records",
                        to="audit_logging.auditlog",
                    ),
                ),
            ],
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name="CalculationLog",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("timestamp", models.DateTimeField(auto_now_add=True)),
                ("calculationId", models.TextField(default="test_id")),
                ("calculation_log", models.TextField(default="")),
                ("object_id", models.PositiveIntegerField(blank=True, null=True)),
                (
                    "audit_log",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="audit_logging.auditlog",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                    ),
                ),
                (
                    "parent_log",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="parent_logs",
                        to="audit_logging.calculationlog",
                    ),
                ),
            ],
        ),
    ]
