# Generated by Django 5.2.14 on 2026-06-15 01:01

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


class Migration(migrations.Migration):

    dependencies = [
        ("annotations", "0080_corpusreference_classification"),
        (
            "corpuses",
            "0057_rename_corpuses_co_corpus__vote_idx_corpuses_co_corpus__64f0b6_idx_and_more",
        ),
    ]

    operations = [
        migrations.CreateModel(
            name="AuthorityNamespace",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("prefix", models.CharField(db_index=True, max_length=64, unique=True)),
                ("display_name", models.CharField(max_length=255)),
                (
                    "jurisdiction",
                    models.CharField(
                        blank=True, db_index=True, max_length=64, null=True
                    ),
                ),
                (
                    "authority_type",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("statute", "statute"),
                            ("regulation", "regulation"),
                            ("admin-rule", "admin-rule"),
                            ("municipal-ordinance", "municipal-ordinance"),
                            ("case", "case"),
                            ("constitution", "constitution"),
                            ("court-rule", "court-rule"),
                            ("guidance", "guidance"),
                            ("treaty", "treaty"),
                        ],
                        db_index=True,
                        max_length=32,
                        null=True,
                    ),
                ),
                ("aliases", models.JSONField(blank=True, default=list)),
                ("provider", models.CharField(blank=True, max_length=64, null=True)),
                (
                    "source_root_url",
                    models.URLField(blank=True, max_length=500, null=True),
                ),
                ("license", models.CharField(blank=True, max_length=64, null=True)),
                ("is_global", models.BooleanField(db_index=True, default=True)),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                (
                    "authority_corpus",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="authority_namespaces",
                        to="corpuses.corpus",
                    ),
                ),
            ],
            options={
                "indexes": [
                    models.Index(
                        fields=["jurisdiction", "authority_type"],
                        name="annotations_jurisdi_50c7cc_idx",
                    )
                ],
            },
        ),
    ]
