# Generated by Django 5.2.18 on 2026-11-15 23:50

import apps.core.ids
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 = [
        ("agencies", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Announcement",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=apps.core.ids.uuid7,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "scope",
                    models.CharField(
                        choices=[("NATIONAL", "National"), ("AGENCY", "Agence")],
                        default="AGENCY",
                        max_length=10,
                    ),
                ),
                ("title", models.CharField(max_length=180)),
                ("body", models.TextField()),
                ("starts_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("ends_at", models.DateTimeField(blank=True, null=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("DRAFT", "Brouillon"),
                            ("PUBLISHED", "Publiée"),
                            ("ARCHIVED", "Archivée"),
                        ],
                        default="PUBLISHED",
                        max_length=10,
                    ),
                ),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now)),
                (
                    "agency",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="announcements",
                        to="agencies.agency",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "annonce",
                "ordering": ["-starts_at"],
                "permissions": [
                    ("publish_announcement", "Peut publier une annonce locale"),
                    (
                        "publish_national_announcement",
                        "Peut publier une annonce nationale",
                    ),
                ],
            },
        ),
        migrations.CreateModel(
            name="Notification",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=apps.core.ids.uuid7,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("notification_type", models.CharField(default="INFO", max_length=32)),
                (
                    "priority",
                    models.CharField(
                        choices=[
                            ("LOW", "Basse"),
                            ("NORMAL", "Normale"),
                            ("HIGH", "Haute"),
                        ],
                        default="NORMAL",
                        max_length=10,
                    ),
                ),
                ("title", models.CharField(max_length=180)),
                ("body", models.TextField(blank=True)),
                ("action_url", models.CharField(blank=True, max_length=255)),
                ("read_at", models.DateTimeField(blank=True, null=True)),
                (
                    "created_at",
                    models.DateTimeField(
                        db_index=True, default=django.utils.timezone.now
                    ),
                ),
                (
                    "agency",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="notifications",
                        to="agencies.agency",
                    ),
                ),
                (
                    "recipient",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="notifications",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "notification",
                "ordering": ["-created_at"],
            },
        ),
    ]
