# Generated by Django 4.2.7 on 2026-01-27 14:01

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("accounts", "0003_buyerprofile_following_count_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Product",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=200)),
                ("price", models.DecimalField(decimal_places=2, max_digits=10)),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("fashion", "Fashion"),
                            ("electronics", "Electronics"),
                            ("food", "Food"),
                            ("beauty", "Beauty"),
                            ("home", "Home & Garden"),
                            ("services", "Services"),
                            ("vehicles", "Vehicles"),
                            ("phones", "Phones & Tablets"),
                            ("computers", "Computers"),
                            ("health", "Health"),
                            ("sports", "Sports & Outdoors"),
                            ("books", "Books & Education"),
                            ("other", "Other"),
                        ],
                        max_length=20,
                    ),
                ),
                (
                    "condition",
                    models.CharField(
                        choices=[
                            ("new", "Brand New"),
                            ("like_new", "Like New"),
                            ("good", "Good"),
                            ("fair", "Fair"),
                            ("used", "Used"),
                        ],
                        max_length=20,
                    ),
                ),
                ("description", models.TextField(max_length=300)),
                ("is_available", models.BooleanField(default=True)),
                ("is_negotiable", models.BooleanField(default=False)),
                (
                    "tags",
                    models.CharField(
                        blank=True,
                        help_text="Comma-separated tags",
                        max_length=200,
                        null=True,
                    ),
                ),
                ("primary_image", models.ImageField(upload_to="products/")),
                (
                    "old_price",
                    models.DecimalField(
                        blank=True,
                        decimal_places=2,
                        help_text="Original price for discount display",
                        max_digits=10,
                        null=True,
                    ),
                ),
                (
                    "video",
                    models.FileField(
                        blank=True, null=True, upload_to="product_videos/"
                    ),
                ),
                ("is_featured", models.BooleanField(default=False)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("active", "Active"),
                            ("sold", "Sold"),
                            ("paused", "Paused"),
                            ("deleted", "Deleted"),
                        ],
                        default="active",
                        max_length=20,
                    ),
                ),
                ("views", models.IntegerField(default=0)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "vendor",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="products",
                        to="accounts.vendorprofile",
                    ),
                ),
            ],
            options={
                "db_table": "products",
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="ProductImage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("image", models.ImageField(upload_to="products/")),
                ("order", models.IntegerField(default=0)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "product",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="additional_images",
                        to="products.product",
                    ),
                ),
            ],
            options={
                "db_table": "product_images",
                "ordering": ["order"],
            },
        ),
        migrations.CreateModel(
            name="Wishlist",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "buyer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="wishlists",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "product",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="wishlisted_by",
                        to="products.product",
                    ),
                ),
            ],
            options={
                "db_table": "wishlists",
                "ordering": ["-created_at"],
                "unique_together": {("buyer", "product")},
            },
        ),
    ]
