# Generated by Django 5.2.11 on 2026-03-04 02:54

import django.contrib.gis.db.models.fields
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        ("siege_geo", "0002_tract_urbanicity_code_and_more"),
    ]

    operations = [
        migrations.AlterField(
            model_name="demographicsnapshot",
            name="content_type",
            field=models.ForeignKey(
                help_text="Type of boundary this snapshot is for",
                limit_choices_to={
                    "app_label": "siege_geo",
                    "model__in": [
                        "state",
                        "county",
                        "tract",
                        "blockgroup",
                        "block",
                        "place",
                        "zcta",
                        "congressionaldistrict",
                        "statelegislativeupper",
                        "statelegislativelower",
                        "vtd",
                        "precinct",
                        "cbsa",
                        "urbanarea",
                        "schooldistrictelementary",
                        "schooldistrictsecondary",
                        "schooldistrictunified",
                        "gadmcountry",
                        "gadmadmin1",
                        "gadmadmin2",
                        "gadmadmin3",
                        "gadmadmin4",
                        "gadmadmin5",
                        "nlrbregion",
                        "federaljudicialdistrict",
                        "ncesLocaleboundary",
                        "schoollocation",
                    ],
                },
                on_delete=django.db.models.deletion.CASCADE,
                to="contenttypes.contenttype",
            ),
        ),
        migrations.CreateModel(
            name="NCESLocaleBoundary",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "feature_id",
                    models.CharField(
                        db_index=True,
                        help_text="Stable identifier for this feature (unique per vintage_year)",
                        max_length=60,
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Human-readable name of this feature", max_length=255
                    ),
                ),
                (
                    "vintage_year",
                    models.PositiveSmallIntegerField(
                        db_index=True,
                        help_text="Edition year of the source dataset",
                        validators=[
                            django.core.validators.MinValueValidator(1790),
                            django.core.validators.MaxValueValidator(2100),
                        ],
                    ),
                ),
                (
                    "valid_from",
                    models.DateField(
                        blank=True,
                        help_text="Date this feature became effective (NULL = always valid)",
                        null=True,
                    ),
                ),
                (
                    "valid_to",
                    models.DateField(
                        blank=True,
                        help_text="Date this feature ceased to be effective (NULL = still valid)",
                        null=True,
                    ),
                ),
                (
                    "source",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Provenance of this feature (e.g. TIGER/Line, GADM, OSM)",
                        max_length=50,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "boundary_id",
                    models.CharField(
                        db_index=True,
                        help_text="Boundary identifier (synced from feature_id)",
                        max_length=60,
                    ),
                ),
                (
                    "geometry",
                    django.contrib.gis.db.models.fields.MultiPolygonField(
                        help_text="Boundary geometry (WGS 84)", srid=4326
                    ),
                ),
                (
                    "area_land",
                    models.BigIntegerField(
                        blank=True, help_text="Land area in square meters", null=True
                    ),
                ),
                (
                    "area_water",
                    models.BigIntegerField(
                        blank=True, help_text="Water area in square meters", null=True
                    ),
                ),
                (
                    "internal_point",
                    django.contrib.gis.db.models.fields.PointField(
                        blank=True,
                        help_text="Representative interior point (INTPTLAT/INTPTLON)",
                        null=True,
                        srid=4326,
                    ),
                ),
                (
                    "locale_code",
                    models.PositiveSmallIntegerField(
                        db_index=True, help_text="NCES 2-digit locale code (11-43)"
                    ),
                ),
                (
                    "locale_category",
                    models.CharField(
                        help_text="Major category: city, suburban, town, rural",
                        max_length=20,
                    ),
                ),
                (
                    "locale_subcategory",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Full subcategory (e.g. city_large, rural_remote)",
                        max_length=30,
                    ),
                ),
                (
                    "nces_year",
                    models.PositiveSmallIntegerField(
                        db_index=True,
                        help_text="NCES publication year for this boundary",
                    ),
                ),
            ],
            options={
                "verbose_name": "NCES Locale Boundary",
                "verbose_name_plural": "NCES Locale Boundaries",
                "indexes": [
                    models.Index(
                        fields=["locale_category"],
                        name="siege_geo_n_locale__737b19_idx",
                    ),
                    models.Index(
                        fields=["nces_year", "locale_code"],
                        name="siege_geo_n_nces_ye_1cca70_idx",
                    ),
                ],
                "unique_together": {("locale_code", "nces_year")},
            },
        ),
        migrations.CreateModel(
            name="TimezoneGeometry",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "feature_id",
                    models.CharField(
                        db_index=True,
                        help_text="Stable identifier for this feature (unique per vintage_year)",
                        max_length=60,
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Human-readable name of this feature", max_length=255
                    ),
                ),
                (
                    "vintage_year",
                    models.PositiveSmallIntegerField(
                        db_index=True,
                        help_text="Edition year of the source dataset",
                        validators=[
                            django.core.validators.MinValueValidator(1790),
                            django.core.validators.MaxValueValidator(2100),
                        ],
                    ),
                ),
                (
                    "valid_from",
                    models.DateField(
                        blank=True,
                        help_text="Date this feature became effective (NULL = always valid)",
                        null=True,
                    ),
                ),
                (
                    "valid_to",
                    models.DateField(
                        blank=True,
                        help_text="Date this feature ceased to be effective (NULL = still valid)",
                        null=True,
                    ),
                ),
                (
                    "source",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Provenance of this feature (e.g. TIGER/Line, GADM, OSM)",
                        max_length=50,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "boundary_id",
                    models.CharField(
                        db_index=True,
                        help_text="Boundary identifier (synced from feature_id)",
                        max_length=60,
                    ),
                ),
                (
                    "geometry",
                    django.contrib.gis.db.models.fields.MultiPolygonField(
                        help_text="Boundary geometry (WGS 84)", srid=4326
                    ),
                ),
                (
                    "area_land",
                    models.BigIntegerField(
                        blank=True, help_text="Land area in square meters", null=True
                    ),
                ),
                (
                    "area_water",
                    models.BigIntegerField(
                        blank=True, help_text="Water area in square meters", null=True
                    ),
                ),
                (
                    "internal_point",
                    django.contrib.gis.db.models.fields.PointField(
                        blank=True,
                        help_text="Representative interior point (INTPTLAT/INTPTLON)",
                        null=True,
                        srid=4326,
                    ),
                ),
                (
                    "timezone_id",
                    models.CharField(
                        db_index=True,
                        help_text="IANA timezone identifier (e.g. 'America/New_York')",
                        max_length=100,
                    ),
                ),
                (
                    "utc_offset_std",
                    models.DecimalField(
                        blank=True,
                        decimal_places=1,
                        help_text="UTC offset during standard time (hours, e.g. -5.0)",
                        max_digits=4,
                        null=True,
                    ),
                ),
                (
                    "utc_offset_dst",
                    models.DecimalField(
                        blank=True,
                        decimal_places=1,
                        help_text="UTC offset during daylight saving time (hours, e.g. -4.0)",
                        max_digits=4,
                        null=True,
                    ),
                ),
                (
                    "observes_dst",
                    models.BooleanField(
                        default=True,
                        help_text="Whether this timezone observes daylight saving time",
                    ),
                ),
            ],
            options={
                "verbose_name": "Timezone Geometry",
                "verbose_name_plural": "Timezone Geometries",
                "indexes": [
                    models.Index(
                        fields=["timezone_id"], name="siege_geo_t_timezon_be0bf1_idx"
                    ),
                    models.Index(
                        fields=["vintage_year"], name="siege_geo_t_vintage_615203_idx"
                    ),
                ],
                "unique_together": {("timezone_id", "vintage_year")},
            },
        ),
        migrations.CreateModel(
            name="SchoolLocation",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "feature_id",
                    models.CharField(
                        db_index=True,
                        help_text="Stable identifier for this feature (unique per vintage_year)",
                        max_length=60,
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Human-readable name of this feature", max_length=255
                    ),
                ),
                (
                    "vintage_year",
                    models.PositiveSmallIntegerField(
                        db_index=True,
                        help_text="Edition year of the source dataset",
                        validators=[
                            django.core.validators.MinValueValidator(1790),
                            django.core.validators.MaxValueValidator(2100),
                        ],
                    ),
                ),
                (
                    "valid_from",
                    models.DateField(
                        blank=True,
                        help_text="Date this feature became effective (NULL = always valid)",
                        null=True,
                    ),
                ),
                (
                    "valid_to",
                    models.DateField(
                        blank=True,
                        help_text="Date this feature ceased to be effective (NULL = still valid)",
                        null=True,
                    ),
                ),
                (
                    "source",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Provenance of this feature (e.g. TIGER/Line, GADM, OSM)",
                        max_length=50,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "geometry",
                    django.contrib.gis.db.models.fields.PointField(
                        help_text="Point geometry (WGS 84)", srid=4326
                    ),
                ),
                (
                    "ncessch",
                    models.CharField(
                        db_index=True,
                        help_text="NCES school ID (12-digit)",
                        max_length=12,
                    ),
                ),
                (
                    "school_name",
                    models.CharField(help_text="School name from NCES", max_length=255),
                ),
                (
                    "lea_id",
                    models.CharField(
                        db_index=True,
                        help_text="NCES LEA ID for parent district",
                        max_length=7,
                    ),
                ),
                (
                    "locale_code",
                    models.PositiveSmallIntegerField(
                        blank=True,
                        db_index=True,
                        help_text="NCES 2-digit locale code (11-43)",
                        null=True,
                    ),
                ),
                (
                    "locale_category",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Major category: city, suburban, town, rural",
                        max_length=20,
                    ),
                ),
                (
                    "locale_subcategory",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Full subcategory (e.g. city_large, rural_remote)",
                        max_length=30,
                    ),
                ),
                (
                    "state",
                    models.ForeignKey(
                        blank=True,
                        help_text="Parent state",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="school_locations",
                        to="siege_geo.state",
                    ),
                ),
            ],
            options={
                "verbose_name": "School Location",
                "verbose_name_plural": "School Locations",
                "indexes": [
                    models.Index(
                        fields=["lea_id"], name="siege_geo_s_lea_id_7330ab_idx"
                    ),
                    models.Index(
                        fields=["locale_code"], name="siege_geo_s_locale__1d8efd_idx"
                    ),
                    models.Index(
                        fields=["state", "vintage_year"],
                        name="siege_geo_s_state_i_50dcbd_idx",
                    ),
                ],
                "unique_together": {("ncessch", "vintage_year")},
            },
        ),
    ]
