# Generated by Django 5.2 on 2025-05-20 04:57

import uuid

import django.contrib.gis.db.models.fields
import django.db.models.deletion
import django_extensions.db.fields
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("core", "0018_alter_order_human_readable_id"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Address",
            fields=[
                (
                    "uuid",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="unique id is used to surely identify any database object",
                        primary_key=True,
                        serialize=False,
                        verbose_name="unique id",
                    ),
                ),
                (
                    "is_active",
                    models.BooleanField(
                        default=True,
                        help_text="if set to false, this object can't be seen by users without needed permission",
                        verbose_name="is active",
                    ),
                ),
                (
                    "created",
                    django_extensions.db.fields.CreationDateTimeField(
                        auto_now_add=True,
                        help_text="when the object first appeared on the database",
                        verbose_name="created",
                    ),
                ),
                (
                    "modified",
                    django_extensions.db.fields.ModificationDateTimeField(
                        auto_now=True, help_text="when the object was last modified", verbose_name="modified"
                    ),
                ),
                ("street", models.CharField(max_length=255, null=True, verbose_name="street")),
                ("district", models.CharField(max_length=255, null=True, verbose_name="district")),
                ("city", models.CharField(max_length=100, null=True, verbose_name="city")),
                ("region", models.CharField(max_length=100, null=True, verbose_name="region")),
                ("postal_code", models.CharField(max_length=20, null=True, verbose_name="postal code")),
                ("country", models.CharField(max_length=40, null=True, verbose_name="country")),
                (
                    "location",
                    django.contrib.gis.db.models.fields.PointField(
                        blank=True,
                        geography=True,
                        help_text="geolocation point: (longitude, latitude)",
                        null=True,
                        srid=4326,
                    ),
                ),
                (
                    "raw_data",
                    models.JSONField(
                        blank=True, help_text="full JSON response from geocoder for this address", null=True
                    ),
                ),
                (
                    "api_response",
                    models.JSONField(
                        blank=True, help_text="stored JSON response from the geocoding service", null=True
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
            options={
                "verbose_name": "address",
                "verbose_name_plural": "addresses",
                "indexes": [models.Index(fields=["location"], name="core_addres_locatio_eb6b39_idx")],
            },
        ),
    ]
