# Generated by Django 4.2.7 on 2023-11-16 14:11

import uuid

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="APIChangeLog",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("username", models.CharField(blank=True, max_length=200)),
                ("full_path", models.CharField(blank=True, max_length=200)),
                ("method", models.CharField(blank=True, max_length=30)),
                ("timestamp", models.DateTimeField(blank=True)),
                ("data", models.JSONField(default=dict)),
                ("params", models.JSONField(default=dict)),
            ],
            options={
                "verbose_name": "API Change Log",
            },
        ),
        migrations.CreateModel(
            name="AppErrorLog",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "level",
                    models.CharField(
                        choices=[
                            ("WARNING", "Warning"),
                            ("ERROR", "Error"),
                            ("FATAL", "Fatal"),
                        ],
                        max_length=10,
                    ),
                ),
                ("message", models.CharField(max_length=200)),
                (
                    "stack_trace",
                    models.TextField(
                        blank=True,
                        help_text="Stack trace error logging if it's available",
                        null=True,
                    ),
                ),
                (
                    "client_data",
                    models.TextField(
                        blank=True,
                        help_text="Any other client data, user agent, ip address etc",
                        null=True,
                    ),
                ),
                ("timestamp", models.DateTimeField(auto_now_add=True)),
                (
                    "user",
                    models.ForeignKey(
                        blank=True,
                        help_text="User data if available",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "App Error Log",
            },
        ),
    ]
