# Generated by Django 5.2.6 on 2025-09-16 08:59

import uuid

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


class Migration(migrations.Migration):
    dependencies = [
        ("core", "0025_alter_user_short_name"),
    ]

    operations = [
        migrations.AlterField(
            model_name="document",
            name="link_role",
            field=models.CharField(
                choices=[
                    ("reader", "Reader"),
                    ("commenter", "Commenter"),
                    ("editor", "Editor"),
                ],
                default="reader",
                max_length=20,
            ),
        ),
        migrations.AlterField(
            model_name="documentaccess",
            name="role",
            field=models.CharField(
                choices=[
                    ("reader", "Reader"),
                    ("commenter", "Commenter"),
                    ("editor", "Editor"),
                    ("administrator", "Administrator"),
                    ("owner", "Owner"),
                ],
                default="reader",
                max_length=20,
            ),
        ),
        migrations.AlterField(
            model_name="documentaskforaccess",
            name="role",
            field=models.CharField(
                choices=[
                    ("reader", "Reader"),
                    ("commenter", "Commenter"),
                    ("editor", "Editor"),
                    ("administrator", "Administrator"),
                    ("owner", "Owner"),
                ],
                default="reader",
                max_length=20,
            ),
        ),
        migrations.AlterField(
            model_name="invitation",
            name="role",
            field=models.CharField(
                choices=[
                    ("reader", "Reader"),
                    ("commenter", "Commenter"),
                    ("editor", "Editor"),
                    ("administrator", "Administrator"),
                    ("owner", "Owner"),
                ],
                default="reader",
                max_length=20,
            ),
        ),
        migrations.AlterField(
            model_name="templateaccess",
            name="role",
            field=models.CharField(
                choices=[
                    ("reader", "Reader"),
                    ("commenter", "Commenter"),
                    ("editor", "Editor"),
                    ("administrator", "Administrator"),
                    ("owner", "Owner"),
                ],
                default="reader",
                max_length=20,
            ),
        ),
        migrations.CreateModel(
            name="Thread",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True,
                        help_text="date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                ("resolved", models.BooleanField(default=False)),
                ("resolved_at", models.DateTimeField(blank=True, null=True)),
                ("metadata", models.JSONField(blank=True, default=dict)),
                (
                    "creator",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="threads",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="threads",
                        to="core.document",
                    ),
                ),
                (
                    "resolved_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="resolved_threads",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Thread",
                "verbose_name_plural": "Threads",
                "db_table": "impress_thread",
                "ordering": ("-created_at",),
            },
        ),
        migrations.CreateModel(
            name="Comment",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True,
                        help_text="date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                ("body", models.JSONField()),
                ("metadata", models.JSONField(blank=True, default=dict)),
                (
                    "user",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="thread_comment",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "thread",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="comments",
                        to="core.thread",
                    ),
                ),
            ],
            options={
                "verbose_name": "Comment",
                "verbose_name_plural": "Comments",
                "db_table": "impress_comment",
                "ordering": ("created_at",),
            },
        ),
        migrations.CreateModel(
            name="Reaction",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True,
                        help_text="date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                ("emoji", models.CharField(max_length=32)),
                (
                    "comment",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="reactions",
                        to="core.comment",
                    ),
                ),
                (
                    "users",
                    models.ManyToManyField(
                        related_name="reactions", to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
            options={
                "verbose_name": "Reaction",
                "verbose_name_plural": "Reactions",
                "db_table": "impress_comment_reaction",
                "constraints": [
                    models.UniqueConstraint(
                        fields=("comment", "emoji"),
                        name="unique_comment_emoji",
                        violation_error_message="This emoji has already been reacted to this comment.",
                    )
                ],
            },
        ),
    ]
