# Generated by Django 4.1.8 on 2023-04-19 05:42

import uuid

import colorfield.fields
import django.db.models.deletion
import django_better_admin_arrayfield.models.fields
import wbcore.markdown.models
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),
        ("reversion", "0001_squashed_0004_auto_20160611_1202"),
        ("auth", "0012_alter_user_first_name_max_length"),
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="FrontendUserConfiguration",
            fields=[
                ("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ("config", models.JSONField(blank=True, default=dict, null=True)),
                (
                    "parent_configuration",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="child_configurations",
                        to="wbcore.frontenduserconfiguration",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="configurations",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Frontend User Settings",
                "verbose_name_plural": "Frontend User Settings",
            },
        ),
        migrations.CreateModel(
            name="Notification",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=512)),
                ("message", models.TextField(blank=True, null=True)),
                ("buttons", models.JSONField(blank=True, default=list, null=True)),
                ("timestamp_created", models.DateTimeField(auto_now_add=True, verbose_name="Created")),
                ("timestamp_received", models.DateTimeField(blank=True, null=True, verbose_name="Received")),
                ("timestamp_read", models.DateTimeField(blank=True, null=True, verbose_name="Read")),
                ("timestamp_mailed", models.DateTimeField(blank=True, null=True, verbose_name="Mailed")),
                (
                    "send_type",
                    models.CharField(
                        choices=[("system", "System"), ("mail", "Mail"), ("system_and_mail", "System and Mail")],
                        default="system",
                        max_length=32,
                    ),
                ),
                (
                    "recipient",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="notifications",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                ("endpoint", models.URLField(blank=True, max_length=2048, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="Tag",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=255, unique=True)),
                ("color", models.CharField(default="#D3D3D3", max_length=7)),
                ("slug", models.CharField(blank=True, max_length=255, null=True)),
            ],
            options={
                "verbose_name": "Tag",
                "verbose_name_plural": "Tags",
            },
        ),
        migrations.CreateModel(
            name="RevisionAbstract",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("reversion.revision",),
        ),
        migrations.CreateModel(
            name="VersionAbstract",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("reversion.version",),
        ),
        migrations.CreateModel(
            name="Asset",
            fields=[
                ("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ("file", models.FileField(upload_to=wbcore.markdown.models.upload_to)),
                ("content_type", models.CharField(blank=True, max_length=32, null=True)),
                ("file_url_name", models.CharField(blank=True, max_length=1024, null=True)),
            ],
            options={
                "verbose_name": "Asset",
                "verbose_name_plural": "Assets",
            },
        ),
        migrations.CreateModel(
            name="BigUserObjectPermission",
            fields=[
                ("object_pk", models.CharField(max_length=255, verbose_name="object ID")),
                ("id", models.BigAutoField(editable=False, primary_key=True, serialize=False, unique=True)),
                (
                    "content_type",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="contenttypes.contenttype"),
                ),
                ("permission", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="auth.permission")),
                ("user", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddIndex(
            model_name="biguserobjectpermission",
            index=models.Index(fields=["content_type", "object_pk"], name="wbcore_big_content_6fb9b7_idx"),
        ),
        migrations.AddIndex(
            model_name="biguserobjectpermission",
            index=models.Index(fields=["content_type", "object_pk", "user"], name="wbcore_big_content_bcec08_idx"),
        ),
        migrations.AlterUniqueTogether(
            name="biguserobjectpermission",
            unique_together={("user", "permission", "object_pk")},
        ),
        migrations.CreateModel(
            name="BigGroupObjectPermission",
            fields=[
                ("object_pk", models.CharField(max_length=255, verbose_name="object ID")),
                ("id", models.BigAutoField(editable=False, primary_key=True, serialize=False, unique=True)),
                (
                    "content_type",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="contenttypes.contenttype"),
                ),
                ("group", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="auth.group")),
                ("permission", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="auth.permission")),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddIndex(
            model_name="biggroupobjectpermission",
            index=models.Index(fields=["content_type", "object_pk"], name="wbcore_big_content_9cf161_idx"),
        ),
        migrations.AddIndex(
            model_name="biggroupobjectpermission",
            index=models.Index(fields=["content_type", "object_pk", "group"], name="wbcore_big_content_c9791f_idx"),
        ),
        migrations.AlterUniqueTogether(
            name="biggroupobjectpermission",
            unique_together={("group", "permission", "object_pk")},
        ),
        migrations.CreateModel(
            name="ReleaseNote",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("version", models.CharField(help_text="The version/identifier of the release", max_length=18)),
                ("release_date", models.DateField(help_text="The date, when this new version was released")),
                ("module", models.CharField(help_text="The workbench-module of the release", max_length=255)),
                ("notes", models.TextField(default="", help_text="What's new? What's improved? What's fixed?")),
                ("read_by", models.ManyToManyField(related_name="read_patch_notes", to=settings.AUTH_USER_MODEL)),
            ],
            options={
                "verbose_name": "Release Note",
                "verbose_name_plural": "Release Notes",
            },
        ),
        migrations.AddConstraint(
            model_name="releasenote",
            constraint=models.UniqueConstraint(
                fields=("version", "module"), name="release_note_unique_version_module"
            ),
        ),
        migrations.AddField(
            model_name="releasenote",
            name="summary",
            field=models.CharField(default="abc", help_text="A brief summary of the release", max_length=512),
            preserve_default=False,
        ),
        migrations.DeleteModel(
            name="RevisionAbstract",
        ),
        migrations.DeleteModel(
            name="VersionAbstract",
        ),
        migrations.DeleteModel(
            name="Tag",
        ),
        migrations.AlterField(
            model_name="asset",
            name="file",
            field=models.FileField(max_length=256, upload_to=wbcore.markdown.models.upload_to),
        ),
        migrations.AddField(
            model_name="biggroupobjectpermission",
            name="editable",
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name="biguserobjectpermission",
            name="editable",
            field=models.BooleanField(default=True),
        ),
        migrations.CreateModel(
            name="PermissionTestModel",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "permission_type",
                    models.CharField(
                        choices=[("INTERNAL", "Internal"), ("PUBLIC", "Public"), ("PRIVATE", "Private")],
                        default="PRIVATE",
                        max_length=8,
                    ),
                ),
            ],
            options={
                "abstract": False,
                "managed": False,
                "default_permissions": ("add", "change", "delete", "view", "administrate"),
            },
        ),
        migrations.CreateModel(
            name="ColorGradient",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(default="", max_length=128)),
                (
                    "colors",
                    django_better_admin_arrayfield.models.fields.ArrayField(
                        base_field=colorfield.fields.ColorField(
                            default="#FF0000", image_field=None, max_length=18, samples=None
                        ),
                        default=list,
                        size=None,
                    ),
                ),
            ],
        ),
        migrations.AlterField(
            model_name="releasenote",
            name="module",
            field=models.CharField(help_text="The workbench module of the release", max_length=255),
        ),
        migrations.AlterField(
            model_name="releasenote",
            name="release_date",
            field=models.DateField(help_text="The date when this new version was released"),
        ),
        migrations.AlterField(
            model_name="releasenote",
            name="read_by",
            field=models.ManyToManyField(
                db_table="bridger_releasenote_read_by", related_name="read_patch_notes", to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AlterModelTable(
            name="asset",
            table="bridger_asset",
        ),
        migrations.AlterModelTable(
            name="biggroupobjectpermission",
            table="bridger_biggroupobjectpermission",
        ),
        migrations.AlterModelTable(
            name="biguserobjectpermission",
            table="bridger_biguserobjectpermission",
        ),
        migrations.AlterModelTable(
            name="colorgradient",
            table="bridger_colorgradient",
        ),
        migrations.AlterModelTable(
            name="frontenduserconfiguration",
            table="bridger_frontenduserconfiguration",
        ),
        migrations.AlterModelTable(
            name="notification",
            table="bridger_notification",
        ),
        migrations.AlterModelTable(
            name="releasenote",
            table="bridger_releasenote",
        ),
        migrations.RenameIndex(
            model_name="biggroupobjectpermission",
            new_name="bridger_big_content_9cf161_idx",
            old_name="wbcore_big_content_9cf161_idx",
        ),
        migrations.RenameIndex(
            model_name="biggroupobjectpermission",
            new_name="bridger_big_content_c9791f_idx",
            old_name="wbcore_big_content_c9791f_idx",
        ),
        migrations.RenameIndex(
            model_name="biguserobjectpermission",
            new_name="bridger_big_content_6fb9b7_idx",
            old_name="wbcore_big_content_6fb9b7_idx",
        ),
        migrations.RenameIndex(
            model_name="biguserobjectpermission",
            new_name="bridger_big_content_bcec08_idx",
            old_name="wbcore_big_content_bcec08_idx",
        ),
        migrations.AlterField(
            model_name="notification",
            name="endpoint",
            field=models.CharField(blank=True, max_length=2048, null=True),
        ),
        migrations.AddField(
            model_name="notification",
            name="share_endpoint_as_widget",
            field=models.BooleanField(
                default=True,
                help_text="If True, it will share the endpoint as widget_endpoint. Otherwise, sends the endpoint as url",
            ),
        ),
        migrations.DeleteModel(
            name="PermissionTestModel",
        ),
        migrations.CreateModel(
            name="Preset",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=64)),
                ("display_identifier", models.CharField(max_length=512)),
                ("display", models.JSONField(blank=True, null=True)),
                (
                    "user",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="presets",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="AppliedPreset",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("display_identifier_path", models.CharField(max_length=1024)),
                ("display", models.JSONField(blank=True, null=True)),
                (
                    "preset",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="applied_presets",
                        to="wbcore.preset",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="applied_presets",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
    ]
