# Generated by Django 6.0.2 on 2026-02-04 15:48

import django.db.models.deletion
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),
    ]

    operations = [
        migrations.CreateModel(
            name="Namespace",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.SlugField(max_length=256, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name="Author",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("h_card", models.JSONField()),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Post",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=512, unique=True)),
                ("content", models.TextField()),
                ("slug", models.SlugField(blank=True, max_length=256, unique=True)),
                ("summary", models.CharField(blank=True, max_length=1024)),
                ("is_published", models.BooleanField(default=False)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("published_at", models.DateTimeField(blank=True, null=True)),
                ("changed_at", models.DateTimeField(auto_now=True)),
                (
                    "author",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="django_mosaic.author",
                    ),
                ),
                (
                    "namespace",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="django_mosaic.namespace",
                    ),
                ),
            ],
            options={
                "ordering": ["-published_at"],
            },
        ),
        migrations.CreateModel(
            name="ContentImage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("image", models.ImageField(upload_to="content/images/")),
                (
                    "thumb",
                    models.ImageField(
                        blank=True,
                        editable=False,
                        null=True,
                        upload_to="content/images/",
                    ),
                ),
                ("caption", models.CharField(blank=True, default="", max_length=2048)),
                ("alt", models.CharField(blank=True, default="", max_length=2048)),
                (
                    "post",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="django_mosaic.post",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Tag",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=256)),
                (
                    "namespace",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="django_mosaic.namespace",
                    ),
                ),
            ],
            options={
                "unique_together": {("name", "namespace")},
            },
        ),
        migrations.AddField(
            model_name="post",
            name="tags",
            field=models.ManyToManyField(blank=True, to="django_mosaic.tag"),
        ),
    ]
