# Generated by Django 5.2.13 on 2026-04-29 09:40

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


class Migration(migrations.Migration):

    dependencies = [
        ("smehub_linkage", "0004_phase6_mou_two_party_signoff"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="RegulatoryGuide",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("title", models.CharField(max_length=255)),
                ("slug", models.SlugField(max_length=128, unique=True)),
                (
                    "body_type",
                    models.CharField(
                        choices=[
                            ("standard", "Standard / specification"),
                            ("approval", "Regulatory approval"),
                            ("licensing", "Licensing pathway"),
                            ("certification", "Certification scheme"),
                            ("policy", "Policy / framework"),
                            ("other", "Other"),
                        ],
                        db_index=True,
                        default="standard",
                        max_length=24,
                    ),
                ),
                (
                    "sectors",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="List of sector tokens this guide applies to (e.g. ['agriculture','health']).",
                    ),
                ),
                (
                    "countries",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="ISO-3166 alpha-2 country codes; empty list = applies regionally.",
                    ),
                ),
                ("summary", models.TextField()),
                ("issuing_authority", models.CharField(blank=True, max_length=255)),
                ("official_link", models.URLField(blank=True)),
                ("last_reviewed_at", models.DateTimeField(blank=True, null=True)),
                ("is_active", models.BooleanField(db_index=True, default=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="smehub_regulatory_guides_authored",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ["title"],
                "indexes": [
                    models.Index(
                        fields=["is_active", "body_type"], name="smehub_link_is_acti_e3fc7f_idx"
                    )
                ],
            },
        ),
    ]
