# Generated by Django 5.2 on 2026-04-26 10:36

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("agent", "0001_initial"),
        ("category", "0001_initial"),
        ("city", "0001_initial"),
        ("country", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="PropertyReviews",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_active", models.BooleanField(default=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "review_star",
                    models.PositiveIntegerField(
                        blank=True,
                        validators=[
                            django.core.validators.MinValueValidator(1),
                            django.core.validators.MaxValueValidator(5),
                        ],
                    ),
                ),
                ("message", models.TextField()),
                (
                    "review_image",
                    models.ImageField(
                        blank=True, null=True, upload_to="review_images/property"
                    ),
                ),
                ("is_flagged_review", models.BooleanField(blank=True, default=False)),
            ],
            options={
                "verbose_name_plural": "property_reviews",
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="Property",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_active", models.BooleanField(default=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=100)),
                ("address", models.CharField(max_length=250)),
                (
                    "per_sqr_ft_price",
                    models.DecimalField(decimal_places=2, max_digits=10),
                ),
                ("description", models.TextField()),
                (
                    "listed_for",
                    models.IntegerField(choices=[(1, "Buy"), (2, "Rent"), (3, "Sale")]),
                ),
                (
                    "country_name",
                    models.CharField(blank=True, max_length=120, null=True),
                ),
                ("state_name", models.CharField(blank=True, max_length=120, null=True)),
                (
                    "district_name",
                    models.CharField(blank=True, max_length=120, null=True),
                ),
                ("is_related", models.BooleanField(default=False)),
                ("is_flagged", models.BooleanField(default=False)),
                (
                    "contact_number",
                    models.CharField(blank=True, max_length=15, null=True),
                ),
                (
                    "postal_code",
                    models.CharField(
                        blank=True, db_index=True, max_length=10, null=True
                    ),
                ),
                ("is_approved", models.BooleanField(default=False)),
                ("google_map", models.TextField(blank=True, null=True)),
                (
                    "agent",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="agents",
                        to="agent.agent",
                    ),
                ),
                (
                    "category_type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="category",
                        to="category.category",
                    ),
                ),
                (
                    "city",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="property_city",
                        to="city.city",
                    ),
                ),
                (
                    "country",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="property_country",
                        to="country.country",
                    ),
                ),
            ],
            options={
                "verbose_name_plural": "properties",
                "ordering": ["name"],
            },
        ),
    ]
