# Generated by Django 5.2.4 on 2025-11-22 06:23

import django.db.models.deletion
import django.utils.timezone
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="Status",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("content", models.TextField(blank=True, null=True)),
                (
                    "media",
                    models.FileField(
                        blank=True,
                        help_text="Image or video file",
                        null=True,
                        upload_to="status/%Y/%m/%d/",
                    ),
                ),
                (
                    "media_type",
                    models.CharField(
                        choices=[
                            ("image", "Image"),
                            ("video", "Video"),
                            ("text", "Text Only"),
                        ],
                        default="text",
                        max_length=10,
                    ),
                ),
                (
                    "background_color",
                    models.CharField(
                        default="#667eea",
                        help_text="Hex color for text-only status",
                        max_length=7,
                    ),
                ),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("expires_at", models.DateTimeField()),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="statuses",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Status",
                "verbose_name_plural": "Statuses",
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="StatusView",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("viewed_at", models.DateTimeField(default=django.utils.timezone.now)),
                (
                    "status",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="views",
                        to="status.status",
                    ),
                ),
                (
                    "viewer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="status_views",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Status View",
                "verbose_name_plural": "Status Views",
                "ordering": ["-viewed_at"],
            },
        ),
        migrations.AddIndex(
            model_name="status",
            index=models.Index(
                fields=["-created_at"], name="status_stat_created_69fea5_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="status",
            index=models.Index(
                fields=["user", "-created_at"], name="status_stat_user_id_60cc32_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="status",
            index=models.Index(
                fields=["expires_at"], name="status_stat_expires_fdf0f3_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="statusview",
            index=models.Index(
                fields=["status", "-viewed_at"], name="status_stat_status__8382b7_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="statusview",
            index=models.Index(
                fields=["viewer", "-viewed_at"], name="status_stat_viewer__f065d8_idx"
            ),
        ),
        migrations.AlterUniqueTogether(
            name="statusview",
            unique_together={("status", "viewer")},
        ),
    ]
