# Generated by Django 5.2.8 on 2025-11-26 12:15

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


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Currency",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("code", models.CharField(max_length=3, unique=True, verbose_name="Code")),
                ("name", models.CharField(max_length=100, verbose_name="Name")),
                ("symbol", models.CharField(max_length=10, verbose_name="Symbol")),
                ("is_active", models.BooleanField(default=True, verbose_name="Is Active")),
            ],
            options={
                "verbose_name": "Currency",
                "verbose_name_plural": "Currencies",
            },
        ),
        migrations.CreateModel(
            name="Language",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("code", models.CharField(max_length=3, unique=True, verbose_name="Code")),
                (
                    "code2",
                    models.CharField(blank=True, max_length=2, verbose_name="ISO 639-1 Code"),
                ),
                ("name", models.CharField(max_length=100, verbose_name="Name")),
                ("is_active", models.BooleanField(default=True, verbose_name="Is Active")),
            ],
            options={
                "verbose_name": "Language",
                "verbose_name_plural": "Languages",
            },
        ),
        migrations.CreateModel(
            name="Country",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("name", models.CharField(db_index=True, max_length=200)),
                ("name_ascii", models.CharField(blank=True, db_index=True, max_length=200)),
                ("slug", autoslug.fields.AutoSlugField(editable=False, populate_from="name_ascii")),
                ("geoname_id", models.IntegerField(blank=True, null=True, unique=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "code2",
                    models.CharField(max_length=2, unique=True, verbose_name="ISO Alpha-2 Code"),
                ),
                (
                    "code3",
                    models.CharField(max_length=3, unique=True, verbose_name="ISO Alpha-3 Code"),
                ),
                ("fips", models.CharField(blank=True, max_length=2, verbose_name="FIPS Code")),
                (
                    "continent",
                    models.CharField(
                        choices=[
                            ("AF", "Africa"),
                            ("AS", "Asia"),
                            ("EU", "Europe"),
                            ("NA", "North America"),
                            ("SA", "South America"),
                            ("AN", "Antarctica"),
                            ("OC", "Oceania"),
                        ],
                        db_index=True,
                        max_length=2,
                        verbose_name="Continent",
                    ),
                ),
                (
                    "tld",
                    models.CharField(blank=True, max_length=5, verbose_name="Top Level Domain"),
                ),
                (
                    "population",
                    models.BigIntegerField(blank=True, null=True, verbose_name="Population"),
                ),
                (
                    "postal_code_format",
                    models.CharField(
                        blank=True, max_length=100, null=True, verbose_name="Postal Code Format"
                    ),
                ),
                (
                    "postal_code_regex",
                    models.CharField(
                        blank=True, max_length=255, null=True, verbose_name="Postal Code Regex"
                    ),
                ),
                (
                    "flag_png",
                    models.URLField(
                        blank=True, max_length=500, null=True, verbose_name="Flag PNG URL"
                    ),
                ),
                (
                    "flag_svg",
                    models.URLField(
                        blank=True, max_length=500, null=True, verbose_name="Flag PNG URL"
                    ),
                ),
                ("is_active", models.BooleanField(default=True, verbose_name="Is Active")),
                (
                    "neighbors",
                    models.ManyToManyField(
                        blank=True, to="geobank.country", verbose_name="Neighbors"
                    ),
                ),
                (
                    "currency",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="countries",
                        to="geobank.currency",
                        verbose_name="Currency",
                    ),
                ),
                (
                    "languages",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Languages spoken in the country",
                        related_name="countries",
                        to="geobank.language",
                        verbose_name="Languages",
                    ),
                ),
            ],
            options={
                "verbose_name": "Country",
                "verbose_name_plural": "Countries",
            },
        ),
        migrations.CreateModel(
            name="CallingCode",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("code", models.CharField(max_length=20, verbose_name="Code")),
                (
                    "country",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="calling_codes",
                        to="geobank.country",
                        verbose_name="Country",
                    ),
                ),
            ],
            options={
                "verbose_name": "Calling Code",
                "verbose_name_plural": "Calling Codes",
            },
        ),
        migrations.CreateModel(
            name="Region",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("name", models.CharField(db_index=True, max_length=200)),
                ("name_ascii", models.CharField(blank=True, db_index=True, max_length=200)),
                ("slug", autoslug.fields.AutoSlugField(editable=False, populate_from="name_ascii")),
                ("geoname_id", models.IntegerField(blank=True, null=True, unique=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("code", models.CharField(max_length=10, verbose_name="Code")),
                ("is_active", models.BooleanField(default=True, verbose_name="Is Active")),
                (
                    "country",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="regions",
                        to="geobank.country",
                        verbose_name="Country",
                    ),
                ),
            ],
            options={
                "verbose_name": "Region",
                "verbose_name_plural": "Regions",
                "unique_together": {("country", "code")},
            },
        ),
        migrations.CreateModel(
            name="City",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("name", models.CharField(db_index=True, max_length=200)),
                ("name_ascii", models.CharField(blank=True, db_index=True, max_length=200)),
                ("slug", autoslug.fields.AutoSlugField(editable=False, populate_from="name_ascii")),
                ("geoname_id", models.IntegerField(blank=True, null=True, unique=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "latitude",
                    models.DecimalField(
                        blank=True,
                        decimal_places=6,
                        max_digits=9,
                        null=True,
                        verbose_name="Latitude",
                    ),
                ),
                (
                    "longitude",
                    models.DecimalField(
                        blank=True,
                        decimal_places=6,
                        max_digits=9,
                        null=True,
                        verbose_name="Longitude",
                    ),
                ),
                (
                    "population",
                    models.BigIntegerField(blank=True, null=True, verbose_name="Population"),
                ),
                (
                    "timezone",
                    models.CharField(blank=True, max_length=40, null=True, verbose_name="Timezone"),
                ),
                ("is_active", models.BooleanField(default=True, verbose_name="Is Active")),
                (
                    "country",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="cities",
                        to="geobank.country",
                        verbose_name="Country",
                    ),
                ),
                (
                    "region",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="cities",
                        to="geobank.region",
                        verbose_name="Region",
                    ),
                ),
            ],
            options={
                "verbose_name": "City",
                "verbose_name_plural": "Cities",
            },
        ),
    ]
