# Generated by Django 6.0.5 on 2026-05-29 13:42

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


class Migration(migrations.Migration):

    dependencies = [
        ("community", "0003_postcomment_parent_alter_communitypost_content_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="room",
            name="is_private",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="room",
            name="neighborhood",
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name="room",
            name="room_type",
            field=models.CharField(
                choices=[
                    ("neighborhood", "Neighborhood"),
                    ("topic", "Topic"),
                    ("university", "University"),
                    ("election", "Election / Ward"),
                    ("business", "Biashara"),
                    ("user", "User Created"),
                ],
                default="topic",
                max_length=20,
            ),
        ),
        migrations.CreateModel(
            name="BiasharaListing",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=200)),
                ("description", models.TextField()),
                (
                    "price",
                    models.DecimalField(
                        blank=True, decimal_places=2, max_digits=12, null=True
                    ),
                ),
                (
                    "price_label",
                    models.CharField(
                        blank=True,
                        help_text="e.g. 'Free', 'Negotiable', 'KES 500'",
                        max_length=50,
                    ),
                ),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("food", "Food & Groceries"),
                            ("electronics", "Electronics & Gadgets"),
                            ("clothes", "Clothes & Fashion"),
                            ("land", "Land & Property"),
                            ("services", "Services"),
                            ("furniture", "Furniture & Home"),
                            ("vehicles", "Vehicles"),
                            ("other", "Other"),
                        ],
                        default="other",
                        max_length=20,
                    ),
                ),
                (
                    "location",
                    models.CharField(
                        blank=True, help_text="Location in Thika", max_length=100
                    ),
                ),
                ("phone", models.CharField(blank=True, max_length=20)),
                (
                    "image",
                    models.ImageField(blank=True, null=True, upload_to="biashara/"),
                ),
                (
                    "image2",
                    models.ImageField(blank=True, null=True, upload_to="biashara/"),
                ),
                (
                    "image3",
                    models.ImageField(blank=True, null=True, upload_to="biashara/"),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("active", "Active"),
                            ("sold", "Sold"),
                            ("expired", "Expired"),
                        ],
                        default="active",
                        max_length=10,
                    ),
                ),
                ("views_count", models.PositiveIntegerField(default=0)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("expires_at", models.DateTimeField(blank=True, null=True)),
                (
                    "room",
                    models.ForeignKey(
                        blank=True,
                        help_text="Biashara room this was posted to",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="listings",
                        to="community.room",
                    ),
                ),
                (
                    "seller",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="biashara_listings",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="Message",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("content", models.TextField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("is_announcement", models.BooleanField(default=False)),
                (
                    "room",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="community_messages",
                        to="community.room",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ["created_at"],
            },
        ),
    ]
