# Generated by Django 5.2.9 on 2026-01-20 14:14

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


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Country",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("name", models.CharField(db_index=True, max_length=100)),
                ("iso2", models.CharField(db_index=True, max_length=2, unique=True)),
                ("iso3", models.CharField(blank=True, max_length=3, null=True)),
                ("numeric_code", models.CharField(blank=True, max_length=3, null=True)),
                ("phonecode", models.CharField(blank=True, max_length=20, null=True)),
                ("capital", models.CharField(blank=True, max_length=100, null=True)),
                ("currency", models.CharField(blank=True, max_length=3, null=True)),
                ("currency_name", models.CharField(blank=True, max_length=100, null=True)),
                ("currency_symbol", models.CharField(blank=True, max_length=10, null=True)),
                ("tld", models.CharField(blank=True, max_length=10, null=True)),
                ("native", models.CharField(blank=True, max_length=100, null=True)),
                ("region", models.CharField(blank=True, max_length=50, null=True)),
                ("subregion", models.CharField(blank=True, max_length=100, null=True)),
                ("nationality", models.CharField(blank=True, max_length=100, null=True)),
                ("timezones", models.JSONField(blank=True, null=True)),
                ("translations", models.JSONField(blank=True, null=True)),
                ("latitude", models.FloatField(blank=True, null=True)),
                ("longitude", models.FloatField(blank=True, null=True)),
                ("emoji", models.CharField(blank=True, max_length=10, null=True)),
                ("is_active", models.BooleanField(db_index=True, default=True)),
            ],
            options={
                "verbose_name": "Country",
                "verbose_name_plural": "Countries",
                "db_table": "cfg_geo_country",
                "ordering": ["name"],
            },
        ),
        migrations.CreateModel(
            name="State",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("name", models.CharField(db_index=True, max_length=200)),
                ("iso2", models.CharField(blank=True, max_length=10, null=True)),
                ("type", models.CharField(blank=True, max_length=50, null=True)),
                ("latitude", models.FloatField(blank=True, null=True)),
                ("longitude", models.FloatField(blank=True, null=True)),
                ("is_active", models.BooleanField(db_index=True, default=True)),
                (
                    "country",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="states",
                        to="cfg_geo.country",
                    ),
                ),
            ],
            options={
                "verbose_name": "State",
                "verbose_name_plural": "States",
                "db_table": "cfg_geo_state",
                "ordering": ["name"],
            },
        ),
        migrations.CreateModel(
            name="City",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("name", models.CharField(db_index=True, max_length=200)),
                ("latitude", models.FloatField(db_index=True)),
                ("longitude", models.FloatField(db_index=True)),
                ("is_active", models.BooleanField(db_index=True, default=True)),
                (
                    "country",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="cities",
                        to="cfg_geo.country",
                    ),
                ),
                (
                    "state",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="cities",
                        to="cfg_geo.state",
                    ),
                ),
            ],
            options={
                "verbose_name": "City",
                "verbose_name_plural": "Cities",
                "db_table": "cfg_geo_city",
                "ordering": ["name"],
            },
        ),
        migrations.AddIndex(
            model_name="state",
            index=models.Index(fields=["country", "name"], name="cfg_geo_sta_country_ceb101_idx"),
        ),
        migrations.AddIndex(
            model_name="city",
            index=models.Index(fields=["country", "name"], name="cfg_geo_cit_country_fdc71b_idx"),
        ),
        migrations.AddIndex(
            model_name="city",
            index=models.Index(fields=["state", "name"], name="cfg_geo_cit_state_i_cebdd2_idx"),
        ),
        migrations.AddIndex(
            model_name="city",
            index=models.Index(
                fields=["latitude", "longitude"], name="cfg_geo_cit_latitud_fae778_idx"
            ),
        ),
    ]
