# Generated by Django 5.2.5 on 2025-08-11 12:42

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("tenants", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="ComplaintCategory",
            fields=[
                (
                    "category_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("description", models.TextField(blank=True, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "tenant",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="complaint_categories",
                        to="tenants.tenants",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Complaint",
            fields=[
                (
                    "complaint_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("user_hash", models.CharField(max_length=255)),
                ("short_description", models.CharField(max_length=255)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("received", "Received"),
                            ("pending", "Pending"),
                            ("closed", "Closed"),
                        ],
                        default="received",
                        max_length=20,
                    ),
                ),
                ("complaint_text", models.TextField()),
                (
                    "complaint_audio",
                    models.FileField(
                        blank=True, null=True, upload_to="complaint_audio/"
                    ),
                ),
                (
                    "complaint_video",
                    models.FileField(
                        blank=True, null=True, upload_to="complaint_video/"
                    ),
                ),
                ("timestamp", models.DateTimeField(auto_now_add=True)),
                (
                    "tenant",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="complaints",
                        to="tenants.tenants",
                    ),
                ),
                (
                    "category",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="complaints",
                        to="complaints.complaintcategory",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="ComplaintStatusHistory",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("received", "Received"),
                            ("pending", "Pending"),
                            ("closed", "Closed"),
                        ],
                        max_length=20,
                    ),
                ),
                ("changed_at", models.DateTimeField(auto_now_add=True)),
                (
                    "changed_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "complaint",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="status_history",
                        to="complaints.complaint",
                    ),
                ),
            ],
        ),
    ]
