# Generated by Django 3.2.4 on 2021-06-10 13:23

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

import aa_forum.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("auth", "0012_alter_user_first_name_max_length"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="General",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
            ],
            options={
                "verbose_name": "AA-Forum",
                "permissions": (
                    ("basic_access", "Can access the AA-Forum module"),
                    (
                        "manage_forum",
                        "Can manage the AA-Forum module (Categories, topics and "
                        "messages)",
                    ),
                ),
                "managed": False,
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Boards",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(default="", max_length=254)),
                ("description", models.TextField(blank=True, null=True)),
                ("order", models.IntegerField(default=0)),
            ],
            options={
                "verbose_name": "Board",
                "verbose_name_plural": "Boards",
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Settings",
            fields=[
                (
                    "variable",
                    models.CharField(
                        max_length=254, primary_key=True, serialize=False, unique=True
                    ),
                ),
                ("value", models.TextField()),
            ],
            options={
                "verbose_name": "Setting",
                "verbose_name_plural": "Settings",
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Slugs",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug", models.SlugField(allow_unicode=True, max_length=255)),
            ],
            options={
                "verbose_name": "Slug",
                "verbose_name_plural": "Slugs",
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Topics",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("subject", models.CharField(default="", max_length=254)),
                ("is_sticky", models.BooleanField(db_index=True, default=False)),
                ("is_locked", models.BooleanField(db_index=True, default=False)),
                ("num_views", models.IntegerField(default=0)),
                ("num_replies", models.IntegerField(default=0)),
                (
                    "time_modified",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                (
                    "board",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="topics",
                        to="aa_forum.boards",
                    ),
                ),
                (
                    "read_by",
                    models.ManyToManyField(
                        blank=True,
                        related_name="aa_forum_read_topics",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "slug",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="aa_forum.slugs",
                    ),
                ),
                (
                    "user_started",
                    models.ForeignKey(
                        on_delete=models.SET(aa_forum.models.get_sentinel_user),
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user_updated",
                    models.ForeignKey(
                        on_delete=models.SET(aa_forum.models.get_sentinel_user),
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Topic",
                "verbose_name_plural": "Topics",
                "ordering": ["-time_modified"],
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="PersonalMessages",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("time_sent", models.DateTimeField(default=django.utils.timezone.now)),
                ("subject", models.CharField(default="", max_length=254)),
                ("message", models.TextField(blank=True, null=True)),
                ("is_read", models.BooleanField(default=False)),
                (
                    "recipient",
                    models.ForeignKey(
                        on_delete=models.SET(aa_forum.models.get_sentinel_user),
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "sender",
                    models.ForeignKey(
                        on_delete=models.SET(aa_forum.models.get_sentinel_user),
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "slug",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="aa_forum.slugs",
                    ),
                ),
            ],
            options={
                "verbose_name": "Personal Message",
                "verbose_name_plural": "Personal Messages",
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Messages",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "time_posted",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                (
                    "time_modified",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                ("message", models.TextField(blank=True, null=True)),
                (
                    "board",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="messages",
                        to="aa_forum.boards",
                    ),
                ),
                (
                    "read_by",
                    models.ManyToManyField(
                        blank=True,
                        related_name="aa_forum_read_messages",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "topic",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="messages",
                        to="aa_forum.topics",
                    ),
                ),
                (
                    "user_created",
                    models.ForeignKey(
                        on_delete=models.SET(aa_forum.models.get_sentinel_user),
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user_updated",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=models.SET(aa_forum.models.get_sentinel_user),
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Message",
                "verbose_name_plural": "Messages",
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="Categories",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(default="", max_length=254)),
                ("is_collapsible", models.BooleanField(default=False)),
                ("order", models.IntegerField(default=0)),
                (
                    "slug",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="aa_forum.slugs",
                    ),
                ),
            ],
            options={
                "verbose_name": "Category",
                "verbose_name_plural": "Categories",
                "default_permissions": (),
            },
        ),
        migrations.AddField(
            model_name="boards",
            name="category",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="boards",
                to="aa_forum.categories",
            ),
        ),
        migrations.AddField(
            model_name="boards",
            name="groups",
            field=models.ManyToManyField(
                blank=True,
                related_name="aa_forum_boards_group_restriction",
                to="auth.Group",
            ),
        ),
        migrations.AddField(
            model_name="boards",
            name="parent_board",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="child_boards",
                to="aa_forum.boards",
            ),
        ),
        migrations.AddField(
            model_name="boards",
            name="slug",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="aa_forum.slugs",
            ),
        ),
    ]
