# Generated by Django 5.1.7 on 2025-04-17 14:28

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


class Migration(migrations.Migration):
    dependencies = [
        ("amiqus", "0004_update_check_types"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Form",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "amiqus_id",
                    models.CharField(
                        help_text="The id returned from the Amiqus API.",
                        max_length=40,
                        unique=True,
                        verbose_name="Amiqus ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        blank=True,
                        help_text="The timestamp returned from the Amiqus API.",
                        null=True,
                    ),
                ),
                (
                    "raw",
                    models.JSONField(
                        blank=True,
                        help_text="The raw JSON returned from the API.",
                        null=True,
                    ),
                ),
                (
                    "record",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="amiqus.record"
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="The Django user (denormalised from Client to make navigation easier).",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="amiqus_forms",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Step",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "amiqus_check",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="step",
                        to="amiqus.check",
                    ),
                ),
                (
                    "form",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="step",
                        to="amiqus.form",
                    ),
                ),
                (
                    "record",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="steps",
                        to="amiqus.record",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Review",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "amiqus_id",
                    models.CharField(
                        help_text="The id returned from the Amiqus API.",
                        max_length=40,
                        unique=True,
                        verbose_name="Amiqus ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        blank=True,
                        help_text="The timestamp returned from the Amiqus API.",
                        null=True,
                    ),
                ),
                (
                    "raw",
                    models.JSONField(
                        blank=True,
                        help_text="The raw JSON returned from the API.",
                        null=True,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("pending", "Pending"),
                            ("approved", "Approved"),
                            ("rejected", "Rejected"),
                        ],
                        help_text="The current status of the review (from API).",
                        max_length=20,
                    ),
                ),
                (
                    "step",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="reviews",
                        to="amiqus.step",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
