# Generated by Django 6.0.3 on 2026-05-14 19:43

import django.core.validators
import django.db.models.deletion
import uuid
from decimal import Decimal
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('geo', '0012_franchisepincodecoverage_franchisestoreearning_and_more'),
        ('orders', '0008_payment_review_status'),
        ('products', '0011_add_hsn_code_to_product'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Brand',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('slug', models.SlugField(unique=True)),
                ('logo_url', models.URLField(blank=True, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('website', models.URLField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('slug', models.SlugField(unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('icon_url', models.URLField(blank=True, null=True)),
                ('image_url', models.URLField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('display_order', models.IntegerField(default=0)),
                ('seo_title', models.CharField(blank=True, max_length=255)),
                ('seo_description', models.CharField(blank=True, max_length=500)),
                ('seo_keywords', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name_plural': 'Categories',
                'ordering': ['display_order', 'name'],
            },
        ),
        migrations.CreateModel(
            name='FulfillmentZone',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True)),
                ('state', models.CharField(blank=True, db_index=True, max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='InventoryWarehouse',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255)),
                ('address', models.TextField()),
                ('city', models.CharField(db_index=True, max_length=100)),
                ('state', models.CharField(db_index=True, max_length=100)),
                ('pincode', models.CharField(max_length=10)),
                ('country', models.CharField(default='India', max_length=100)),
                ('manager_name', models.CharField(max_length=255)),
                ('manager_email', models.EmailField(max_length=254)),
                ('manager_phone', models.CharField(max_length=20)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='ShippingRule',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True)),
                ('min_order_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12)),
                ('max_order_value', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('base_shipping_cost', models.DecimalField(decimal_places=2, max_digits=12)),
                ('free_shipping_threshold', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='CouponCode',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('code', models.CharField(max_length=50, unique=True)),
                ('discount_type', models.CharField(choices=[('PERCENTAGE', 'Percentage'), ('FIXED', 'Fixed Amount')], max_length=20)),
                ('discount_value', models.DecimalField(decimal_places=2, max_digits=12)),
                ('min_order_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('max_discount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('valid_from', models.DateTimeField(db_index=True)),
                ('valid_until', models.DateTimeField(db_index=True)),
                ('max_usage', models.PositiveIntegerField(blank=True, help_text='null = unlimited. Use atomic F() update in service to prevent over-redemption.', null=True)),
                ('usage_count', models.PositiveIntegerField(default=0, help_text="NEVER increment via read-then-write. Use F('usage_count') + 1 atomically.")),
                ('max_usage_per_user', models.PositiveIntegerField(default=1)),
                ('is_active', models.BooleanField(db_index=True, default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'indexes': [models.Index(fields=['valid_from', 'valid_until', 'is_active'], name='marketplace_valid_f_abbf83_idx')],
            },
        ),
        migrations.CreateModel(
            name='OrderShipment',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('shipping_method', models.CharField(choices=[('STANDARD', 'Standard'), ('FAST', 'Fast Delivery'), ('EXPRESS', 'Express'), ('PICKUP', 'Customer Pickup')], default='STANDARD', max_length=20)),
                ('shipping_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12)),
                ('estimated_delivery', models.DateField(blank=True, null=True)),
                ('actual_delivery', models.DateField(blank=True, null=True)),
                ('carrier_name', models.CharField(blank=True, max_length=100)),
                ('tracking_number', models.CharField(blank=True, db_index=True, max_length=100)),
                ('tracking_url', models.URLField(blank=True, null=True)),
                ('current_location', models.CharField(blank=True, max_length=255)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PICKED_UP', 'Picked Up'), ('IN_TRANSIT', 'In Transit'), ('OUT_FOR_DELIVERY', 'Out for Delivery'), ('DELIVERED', 'Delivered'), ('FAILED', 'Delivery Failed'), ('RETURNED', 'Returned')], db_index=True, default='PENDING', max_length=25)),
                ('picked_up_at', models.DateTimeField(blank=True, null=True)),
                ('delivered_at', models.DateTimeField(blank=True, null=True)),
                ('last_update', models.DateTimeField(auto_now=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('order', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='shipment', to='orders.order')),
            ],
        ),
        migrations.CreateModel(
            name='ProductReview',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('rating', models.PositiveSmallIntegerField(help_text='Overall star rating 1–5', validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])),
                ('title', models.CharField(blank=True, max_length=255)),
                ('content', models.TextField(blank=True)),
                ('quality_rating', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])),
                ('value_rating', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])),
                ('delivery_rating', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])),
                ('is_verified_purchase', models.BooleanField(default=False)),
                ('is_published', models.BooleanField(default=False, help_text='Set to True after moderation approval')),
                ('helpful_votes', models.PositiveIntegerField(default=0)),
                ('unhelpful_votes', models.PositiveIntegerField(default=0)),
                ('moderation_status', models.CharField(choices=[('PENDING', 'Pending Review'), ('APPROVED', 'Approved'), ('REJECTED', 'Rejected')], db_index=True, default='PENDING', max_length=20)),
                ('moderation_reason', models.TextField(blank=True, null=True)),
                ('moderated_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('moderated_by', models.ForeignKey(blank=True, limit_choices_to={'is_staff': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='moderated_reviews', to=settings.AUTH_USER_MODEL)),
                ('order', models.ForeignKey(blank=True, help_text='Set when review is from a verified purchase', null=True, on_delete=django.db.models.deletion.SET_NULL, to='orders.order')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reviews', to='products.product')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product_reviews', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProductSEO',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('meta_title', models.CharField(max_length=255)),
                ('meta_description', models.CharField(max_length=500)),
                ('meta_keywords', models.TextField(blank=True, help_text='Comma-separated keywords')),
                ('canonical_url', models.URLField(blank=True, null=True)),
                ('og_title', models.CharField(blank=True, max_length=255)),
                ('og_description', models.CharField(blank=True, max_length=500)),
                ('og_image', models.URLField(blank=True, null=True)),
                ('schema_markup', models.JSONField(blank=True, default=dict)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('product', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='seo', to='products.product')),
            ],
        ),
        migrations.CreateModel(
            name='ProductSpecification',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('key', models.CharField(max_length=255)),
                ('value', models.CharField(max_length=255)),
                ('display_order', models.PositiveIntegerField(default=0)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='specifications', to='products.product')),
            ],
            options={
                'ordering': ['display_order'],
            },
        ),
        migrations.CreateModel(
            name='ProductStockSummary',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('company_available', models.PositiveIntegerField(default=0, help_text='Sum of WarehouseStock.available_stock across all warehouses')),
                ('vendor_available', models.PositiveIntegerField(default=0, help_text='Sum of VendorInventory.available_stock across all vendors')),
                ('franchise_available', models.PositiveIntegerField(default=0, help_text='Sum of FranchiseStoreInventory.available_stock across all stores')),
                ('total_available', models.PositiveIntegerField(default=0, help_text='company + vendor + franchise available. For display only.')),
                ('last_updated', models.DateTimeField(auto_now=True)),
                ('product', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='stock_summary', to='products.product')),
            ],
        ),
        migrations.CreateModel(
            name='ProductTag',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('tag', models.CharField(db_index=True, max_length=100)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='marketplace_tags', to='products.product')),
            ],
        ),
        migrations.CreateModel(
            name='ProductVariant',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('sku', models.CharField(max_length=100, unique=True)),
                ('name', models.CharField(help_text="e.g., 'Red – Size M'", max_length=255)),
                ('mrp', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('selling_price', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('buy_price', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('stock', models.PositiveIntegerField(default=0)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variants', to='products.product')),
            ],
        ),
        migrations.CreateModel(
            name='ProductVideo',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('video_url', models.URLField()),
                ('title', models.CharField(blank=True, max_length=255)),
                ('description', models.TextField(blank=True)),
                ('video_type', models.CharField(choices=[('YOUTUBE', 'YouTube'), ('VIMEO', 'Vimeo'), ('UPLOAD', 'Uploaded')], default='YOUTUBE', max_length=20)),
                ('display_order', models.PositiveIntegerField(default=0)),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='marketplace_videos', to='products.product')),
            ],
            options={
                'ordering': ['display_order'],
            },
        ),
        migrations.CreateModel(
            name='ReviewMedia',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('media_type', models.CharField(choices=[('IMAGE', 'Image'), ('VIDEO', 'Video')], max_length=20)),
                ('media_url', models.URLField()),
                ('caption', models.CharField(blank=True, max_length=255)),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('review', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='media', to='marketplace.productreview')),
            ],
        ),
        migrations.CreateModel(
            name='ShippingRulePincode',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('pincode', models.CharField(max_length=20)),
                ('is_serviceable', models.BooleanField(default=True)),
                ('rule', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pincode_rules', to='marketplace.shippingrule')),
            ],
        ),
        migrations.CreateModel(
            name='ShoppingCart',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='shopping_cart', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='CartPromotion',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('discount_amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('applied_at', models.DateTimeField(auto_now_add=True)),
                ('coupon', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='marketplace.couponcode')),
                ('cart', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='promotions', to='marketplace.shoppingcart')),
            ],
        ),
        migrations.CreateModel(
            name='CartItem',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('quantity', models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)])),
                ('unit_price', models.DecimalField(decimal_places=2, help_text='Price at add-to-cart time. Re-validate at checkout if expired.', max_digits=12)),
                ('price_captured_at', models.DateTimeField(auto_now_add=True, help_text='When unit_price was last captured. Used to detect stale pricing.')),
                ('price_expires_at', models.DateTimeField(blank=True, help_text='If set, checkout must re-fetch price if now() > price_expires_at.', null=True)),
                ('added_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product')),
                ('variant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='marketplace.productvariant')),
                ('cart', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='marketplace.shoppingcart')),
            ],
        ),
        migrations.CreateModel(
            name='StockMovement',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('movement_type', models.CharField(choices=[('IN', 'Stock In'), ('OUT', 'Stock Out'), ('ADJUSTMENT', 'Manual Adjustment'), ('DAMAGE', 'Damage Write-off'), ('RETURN', 'Customer Return'), ('RESERVE', 'Order Reservation'), ('RELEASE', 'Reservation Release')], db_index=True, max_length=20)),
                ('quantity', models.IntegerField(help_text='Positive=in, Negative=out')),
                ('reference_po', models.CharField(blank=True, max_length=100)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='products.product')),
                ('recorded_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stock_movements', to=settings.AUTH_USER_MODEL)),
                ('reference_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='orders.order')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stock_movements', to='marketplace.inventorywarehouse')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='SubCategory',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255)),
                ('slug', models.SlugField()),
                ('description', models.TextField(blank=True, null=True)),
                ('image_url', models.URLField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('display_order', models.IntegerField(default=0)),
                ('seo_title', models.CharField(blank=True, max_length=255)),
                ('seo_description', models.CharField(blank=True, max_length=500)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='subcategories', to='marketplace.category')),
            ],
            options={
                'verbose_name_plural': 'Sub Categories',
                'ordering': ['display_order', 'name'],
            },
        ),
        migrations.CreateModel(
            name='VariantAttribute',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('attribute_name', models.CharField(max_length=100)),
                ('attribute_value', models.CharField(max_length=100)),
                ('variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attributes', to='marketplace.productvariant')),
            ],
        ),
        migrations.CreateModel(
            name='Vendor',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('company_name', models.CharField(max_length=255)),
                ('company_registration_number', models.CharField(max_length=100, unique=True)),
                ('tax_id', models.CharField(max_length=100, unique=True)),
                ('business_email', models.EmailField(max_length=254)),
                ('business_phone', models.CharField(max_length=20)),
                ('business_address', models.TextField()),
                ('city', models.CharField(max_length=100)),
                ('state', models.CharField(max_length=100)),
                ('pincode', models.CharField(max_length=10)),
                ('country', models.CharField(default='India', max_length=100)),
                ('store_name', models.CharField(max_length=255)),
                ('store_description', models.TextField(blank=True)),
                ('store_logo_url', models.URLField(blank=True, null=True)),
                ('store_banner_url', models.URLField(blank=True, null=True)),
                ('status', models.CharField(choices=[('PENDING', 'Pending Approval'), ('APPROVED', 'Approved'), ('SUSPENDED', 'Suspended'), ('REJECTED', 'Rejected')], db_index=True, default='PENDING', max_length=20)),
                ('is_active', models.BooleanField(default=False)),
                ('approval_date', models.DateTimeField(blank=True, null=True)),
                ('suspension_reason', models.TextField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='vendor_profile', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='OrderItem',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('quantity', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1)])),
                ('unit_price', models.DecimalField(decimal_places=2, help_text='Price at time of order (snapshot — never updated after creation)', max_digits=12)),
                ('total_price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('discount_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12)),
                ('tax_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12)),
                ('fulfillment_mode', models.CharField(blank=True, choices=[('VENDOR_FULFILLED', 'Vendor Fulfilled'), ('COMPANY_FULFILLED', 'Company Fulfilled'), ('FRANCHISE_FULFILLED', 'Franchise Fulfilled'), ('PICKUP_POINT', 'Customer Pickup Point')], help_text='Determined by FulfillmentService at order creation', max_length=25, null=True)),
                ('item_status', models.CharField(choices=[('PENDING', 'Pending'), ('CONFIRMED', 'Confirmed'), ('PACKED', 'Packed'), ('SHIPPED', 'Shipped'), ('DELIVERED', 'Delivered'), ('CANCELLED', 'Cancelled'), ('RETURNED', 'Returned')], db_index=True, default='PENDING', max_length=20)),
                ('franchise_store', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fulfilled_order_items', to='geo.franchisestore')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='orders.order')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='order_items', to='products.product')),
                ('variant', models.ForeignKey(blank=True, help_text='Set if customer selected a specific variant (size/colour/etc.)', null=True, on_delete=django.db.models.deletion.SET_NULL, to='marketplace.productvariant')),
                ('vendor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fulfilled_items', to='marketplace.vendor')),
            ],
        ),
        migrations.CreateModel(
            name='FulfillmentTask',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('fulfillment_mode', models.CharField(choices=[('VENDOR_FULFILLED', 'Vendor Fulfilled'), ('COMPANY_FULFILLED', 'Company Fulfilled'), ('FRANCHISE_FULFILLED', 'Franchise Fulfilled'), ('PICKUP_POINT', 'Customer Pickup Point')], max_length=25)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('ACCEPTED', 'Accepted'), ('PACKED', 'Packed'), ('PICKED_UP', 'Picked Up'), ('IN_TRANSIT', 'In Transit'), ('DELIVERED', 'Delivered'), ('FAILED', 'Failed')], db_index=True, default='PENDING', max_length=20)),
                ('deadline', models.DateTimeField()),
                ('assigned_at', models.DateTimeField(auto_now_add=True)),
                ('accepted_at', models.DateTimeField(blank=True, null=True)),
                ('completed_at', models.DateTimeField(blank=True, null=True)),
                ('assigned_to_store', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fulfillment_tasks', to='geo.franchisestore')),
                ('order_item', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='fulfillment_task', to='marketplace.orderitem')),
                ('assigned_to_vendor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fulfillment_tasks', to='marketplace.vendor')),
            ],
        ),
        migrations.CreateModel(
            name='FulfillmentRoute',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('priority', models.PositiveIntegerField(default=0, help_text='Lower = higher priority. Evaluated in ascending order.')),
                ('fulfillment_mode', models.CharField(choices=[('VENDOR_FULFILLED', 'Vendor Fulfilled'), ('COMPANY_FULFILLED', 'Company Fulfilled'), ('FRANCHISE_FULFILLED', 'Franchise Fulfilled'), ('PICKUP_POINT', 'Customer Pickup Point')], max_length=25)),
                ('sla_days', models.PositiveIntegerField(help_text='Expected days to fulfill from this route')),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('franchise_store', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fulfillment_routes', to='geo.franchisestore')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fulfillment_routes', to='products.product')),
                ('zone', models.ForeignKey(blank=True, help_text='null = global fallback route (applies to all zones)', null=True, on_delete=django.db.models.deletion.SET_NULL, to='marketplace.fulfillmentzone')),
                ('vendor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fulfillment_routes', to='marketplace.vendor')),
            ],
            options={
                'ordering': ['priority'],
            },
        ),
        migrations.CreateModel(
            name='VendorBankAccount',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('account_holder_name', models.CharField(max_length=255)),
                ('account_number', models.CharField(max_length=20)),
                ('account_type', models.CharField(choices=[('SAVINGS', 'Savings'), ('CURRENT', 'Current')], max_length=20)),
                ('ifsc_code', models.CharField(max_length=11)),
                ('bank_name', models.CharField(max_length=255)),
                ('is_verified', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('vendor', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='bank_account', to='marketplace.vendor')),
            ],
        ),
        migrations.CreateModel(
            name='VendorContract',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('contract_number', models.CharField(max_length=100, unique=True)),
                ('start_date', models.DateField()),
                ('end_date', models.DateField()),
                ('base_commission_percentage', models.DecimalField(decimal_places=2, default=Decimal('10.00'), max_digits=5)),
                ('is_active', models.BooleanField(default=True)),
                ('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='contracts', to='marketplace.vendor')),
            ],
        ),
        migrations.CreateModel(
            name='ContractPricing',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('pricing_tier', models.CharField(choices=[('GLOBAL', 'Global'), ('PINCODE', 'Pincode-based'), ('FRANCHISE', 'Franchise-store-based')], default='GLOBAL', max_length=20)),
                ('pincode', models.CharField(blank=True, max_length=10, null=True)),
                ('buy_price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('sell_price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('margin_percentage', models.DecimalField(decimal_places=2, max_digits=5)),
                ('valid_from', models.DateTimeField()),
                ('valid_until', models.DateTimeField()),
                ('franchise_store', models.ForeignKey(blank=True, help_text='Franchise store this pricing rule applies to (FRANCHISE tier only)', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contract_pricing_rules', to='geo.franchisestore')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contract_pricing', to='products.product')),
                ('contract', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pricing_rules', to='marketplace.vendorcontract')),
            ],
        ),
        migrations.CreateModel(
            name='ContractMargin',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('margin_type', models.CharField(help_text="e.g. 'Premium Products', 'New Launch', 'Seasonal'", max_length=50)),
                ('margin_percentage', models.DecimalField(decimal_places=2, max_digits=5)),
                ('applicable_from', models.DateField()),
                ('applicable_until', models.DateField()),
                ('contract', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='margins', to='marketplace.vendorcontract')),
            ],
        ),
        migrations.CreateModel(
            name='VendorDocument',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('document_type', models.CharField(choices=[('REGISTRATION', 'Company Registration'), ('TAX', 'Tax Certificate'), ('BANK', 'Bank Statement'), ('IDENTITY', 'Identity Proof'), ('BUSINESS_LICENSE', 'Business License'), ('OTHER', 'Other')], max_length=20)),
                ('document_number', models.CharField(max_length=100)),
                ('document_file_url', models.URLField()),
                ('expiry_date', models.DateField(blank=True, null=True)),
                ('is_verified', models.BooleanField(default=False)),
                ('verified_at', models.DateTimeField(blank=True, null=True)),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='marketplace.vendor')),
                ('verified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='verified_vendor_docs', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='VendorEarning',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('gross_amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('commission_percentage', models.DecimalField(decimal_places=2, max_digits=5)),
                ('commission_amount', models.DecimalField(decimal_places=2, help_text='Set by VendorEarningService before save. Do NOT rely on save() to compute.', max_digits=12)),
                ('net_amount', models.DecimalField(decimal_places=2, help_text='gross_amount - commission_amount. Set explicitly by service.', max_digits=12)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PROCESSED', 'Processed'), ('PAID', 'Paid'), ('CANCELLED', 'Cancelled')], db_index=True, default='PENDING', max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('payout_date', models.DateTimeField(blank=True, null=True)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vendor_earnings', to='orders.order')),
                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='earnings', to='marketplace.vendor')),
            ],
        ),
        migrations.CreateModel(
            name='VendorInventory',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('stock', models.PositiveIntegerField(default=0)),
                ('reserved_stock', models.PositiveIntegerField(default=0)),
                ('reorder_point', models.PositiveIntegerField(default=10)),
                ('last_restocked', models.DateTimeField(blank=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vendor_inventories', to='products.product')),
                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inventory', to='marketplace.vendor')),
            ],
        ),
        migrations.CreateModel(
            name='VendorPayout',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('period_start', models.DateField()),
                ('period_end', models.DateField()),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PROCESSING', 'Processing'), ('COMPLETED', 'Completed'), ('FAILED', 'Failed')], db_index=True, default='PENDING', max_length=20)),
                ('transaction_id', models.CharField(blank=True, max_length=100, null=True)),
                ('failure_reason', models.TextField(blank=True, null=True)),
                ('paid_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payouts', to='marketplace.vendor')),
            ],
        ),
        migrations.CreateModel(
            name='WarehouseStock',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('stock', models.PositiveIntegerField(default=0)),
                ('reserved_stock', models.PositiveIntegerField(default=0)),
                ('reorder_point', models.PositiveIntegerField(default=50)),
                ('last_restocked', models.DateTimeField(blank=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='warehouse_stock', to='products.product')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stock', to='marketplace.inventorywarehouse')),
            ],
        ),
        migrations.CreateModel(
            name='Wishlist',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='wishlist', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='WishlistItem',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('added_at', models.DateTimeField(auto_now_add=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product')),
                ('wishlist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='marketplace.wishlist')),
            ],
        ),
        migrations.CreateModel(
            name='ContentHelpfulness',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('object_id', models.UUIDField(db_index=True)),
                ('is_helpful', models.BooleanField()),
                ('voted_at', models.DateTimeField(auto_now_add=True)),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='helpfulness_votes', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'indexes': [models.Index(fields=['content_type', 'object_id'], name='marketplace_content_c9d859_idx'), models.Index(fields=['user'], name='marketplace_user_id_0b8cf0_idx')],
                'unique_together': {('content_type', 'object_id', 'user')},
            },
        ),
        migrations.CreateModel(
            name='CouponUsage',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('used_at', models.DateTimeField(auto_now_add=True)),
                ('coupon', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='usages', to='marketplace.couponcode')),
                ('order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='orders.order')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupon_usages', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'indexes': [models.Index(fields=['coupon', 'user'], name='marketplace_coupon__eb4aeb_idx')],
            },
        ),
        migrations.CreateModel(
            name='FlashOffer',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=255)),
                ('discount_type', models.CharField(choices=[('PERCENTAGE', 'Percentage'), ('FIXED', 'Fixed Amount')], max_length=20)),
                ('discount_value', models.DecimalField(decimal_places=2, max_digits=12)),
                ('valid_from', models.DateTimeField(db_index=True)),
                ('valid_until', models.DateTimeField(db_index=True)),
                ('max_usage', models.PositiveIntegerField(blank=True, help_text='null = unlimited. Use atomic F() update in service to prevent oversell.', null=True)),
                ('usage_count', models.PositiveIntegerField(default=0, help_text="NEVER increment via read-then-write. Use F('usage_count') + 1 atomically.")),
                ('is_active', models.BooleanField(db_index=True, default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='flash_offers', to='products.product')),
            ],
            options={
                'indexes': [models.Index(fields=['product', 'is_active', 'valid_until'], name='marketplace_product_8ff848_idx'), models.Index(fields=['valid_from', 'valid_until', 'is_active'], name='marketplace_valid_f_a701f1_idx')],
            },
        ),
        migrations.CreateModel(
            name='FulfillmentZonePincode',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('pincode', models.CharField(db_index=True, max_length=20)),
                ('zone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pincodes', to='marketplace.fulfillmentzone')),
            ],
            options={
                'indexes': [models.Index(fields=['pincode'], name='marketplace_pincode_22225d_idx')],
                'unique_together': {('zone', 'pincode')},
            },
        ),
        migrations.CreateModel(
            name='DeliveryEstimation',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('to_pincode', models.CharField(db_index=True, max_length=10)),
                ('shipping_method', models.CharField(choices=[('STANDARD', 'Standard'), ('FAST', 'Fast Delivery'), ('EXPRESS', 'Express')], max_length=20)),
                ('estimated_days', models.PositiveIntegerField()),
                ('cost', models.DecimalField(decimal_places=2, max_digits=12)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('from_warehouse', models.ForeignKey(help_text='Source warehouse for this SLA estimate (replaces from_city free text)', on_delete=django.db.models.deletion.CASCADE, related_name='delivery_estimations', to='marketplace.inventorywarehouse')),
            ],
            options={
                'indexes': [models.Index(fields=['to_pincode', 'shipping_method'], name='marketplace_to_pinc_fb231e_idx'), models.Index(fields=['from_warehouse', 'to_pincode'], name='marketplace_from_wa_0b3b14_idx')],
                'unique_together': {('from_warehouse', 'to_pincode', 'shipping_method')},
            },
        ),
        migrations.CreateModel(
            name='LowStockAlert',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('alert_type', models.CharField(choices=[('COMPANY_LOW', 'Company Warehouse Low'), ('VENDOR_LOW', 'Vendor Inventory Low'), ('FRANCHISE_LOW', 'Franchise Store Low')], db_index=True, max_length=20)),
                ('current_stock', models.PositiveIntegerField()),
                ('threshold', models.PositiveIntegerField()),
                ('is_resolved', models.BooleanField(db_index=True, default=False)),
                ('resolved_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='low_stock_alerts', to='products.product')),
            ],
            options={
                'indexes': [models.Index(fields=['product', 'is_resolved'], name='marketplace_product_5a8601_idx'), models.Index(fields=['alert_type', 'is_resolved'], name='marketplace_alert_t_6154a9_idx')],
            },
        ),
        migrations.CreateModel(
            name='OrderStatusHistory',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', models.CharField(max_length=50)),
                ('description', models.TextField(blank=True)),
                ('location', models.CharField(blank=True, max_length=255)),
                ('failure_reason', models.CharField(blank=True, max_length=255, null=True)),
                ('recorded_by', models.CharField(choices=[('SYSTEM', 'System'), ('CARRIER', 'Carrier Webhook'), ('VENDOR', 'Vendor'), ('FRANCHISE', 'Franchise'), ('ADMIN', 'Admin')], default='SYSTEM', max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='status_history', to='orders.order')),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['order', '-created_at'], name='marketplace_order_i_586a4c_idx')],
            },
        ),
        migrations.CreateModel(
            name='PincodeServiceability',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('pincode', models.CharField(db_index=True, max_length=10, unique=True)),
                ('city', models.CharField(blank=True, max_length=100)),
                ('state', models.CharField(blank=True, max_length=100)),
                ('is_serviceable', models.BooleanField(db_index=True, default=True)),
                ('standard_delivery_days', models.PositiveIntegerField(default=5)),
                ('express_delivery_days', models.PositiveIntegerField(default=2)),
                ('franchise_can_deliver', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('assigned_franchise', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='serviceable_pincodes', to='geo.franchisestore')),
            ],
            options={
                'indexes': [models.Index(fields=['is_serviceable'], name='marketplace_is_serv_d402c2_idx'), models.Index(fields=['assigned_franchise', 'is_serviceable'], name='marketplace_assigne_69a828_idx')],
            },
        ),
        migrations.CreateModel(
            name='ProductImage',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('image_url', models.URLField()),
                ('alt_text', models.CharField(blank=True, max_length=255)),
                ('display_order', models.PositiveIntegerField(default=0)),
                ('is_primary', models.BooleanField(default=False)),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='marketplace_images', to='products.product')),
            ],
            options={
                'ordering': ['display_order'],
                'indexes': [models.Index(fields=['product', 'is_primary'], name='marketplace_product_7c7608_idx')],
            },
        ),
        migrations.CreateModel(
            name='ProductPrice',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('price_type', models.CharField(choices=[('GLOBAL', 'Global (all customers, all locations)'), ('PINCODE', 'Pincode-specific'), ('TIER', 'Customer tier-specific'), ('FRANCHISE', 'Franchise-store-specific')], default='GLOBAL', max_length=20)),
                ('pincode', models.CharField(default='__ALL__', help_text="Pincode this price applies to. '__ALL__' = all pincodes.", max_length=10)),
                ('customer_tier', models.CharField(choices=[('GOLD', 'Gold'), ('PLATINUM', 'Platinum'), ('PREMIUM', 'Premium'), ('__ALL__', 'All Tiers')], default='__ALL__', help_text="Customer tier this price applies to. '__ALL__' = all tiers.", max_length=20)),
                ('mrp', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('selling_price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('buy_price', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
                ('valid_from', models.DateTimeField()),
                ('valid_until', models.DateTimeField()),
                ('is_active', models.BooleanField(default=True)),
                ('priority', models.PositiveIntegerField(default=0, help_text='Higher value = higher precedence when multiple rules match')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('franchise_store', models.ForeignKey(blank=True, help_text='Set for FRANCHISE price type. Null for other types.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='product_prices', to='geo.franchisestore')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_rules', to='products.product')),
            ],
            options={
                'indexes': [models.Index(fields=['product', 'price_type', 'valid_until'], name='marketplace_product_8c3989_idx'), models.Index(fields=['valid_from', 'valid_until'], name='marketplace_valid_f_b44071_idx'), models.Index(fields=['product', 'is_active'], name='marketplace_product_4e925b_idx')],
                'unique_together': {('product', 'price_type', 'pincode', 'customer_tier', 'franchise_store')},
            },
        ),
        migrations.AddIndex(
            model_name='productreview',
            index=models.Index(fields=['product', 'is_published', '-created_at'], name='marketplace_product_d71f00_idx'),
        ),
        migrations.AddIndex(
            model_name='productreview',
            index=models.Index(fields=['product', 'moderation_status'], name='marketplace_product_c9677b_idx'),
        ),
        migrations.AddIndex(
            model_name='productreview',
            index=models.Index(fields=['user'], name='marketplace_user_id_e7af4f_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='productreview',
            unique_together={('product', 'user')},
        ),
        migrations.AlterUniqueTogether(
            name='productspecification',
            unique_together={('product', 'key')},
        ),
        migrations.AlterUniqueTogether(
            name='producttag',
            unique_together={('product', 'tag')},
        ),
        migrations.AddIndex(
            model_name='productvariant',
            index=models.Index(fields=['product', 'is_active'], name='marketplace_product_2c75f8_idx'),
        ),
        migrations.AddIndex(
            model_name='shippingrulepincode',
            index=models.Index(fields=['pincode', 'is_serviceable'], name='marketplace_pincode_3aba4a_idx'),
        ),
        migrations.AddIndex(
            model_name='shippingrulepincode',
            index=models.Index(fields=['rule', 'is_serviceable'], name='marketplace_rule_id_6f2eee_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='shippingrulepincode',
            unique_together={('rule', 'pincode')},
        ),
        migrations.AddIndex(
            model_name='cartitem',
            index=models.Index(fields=['cart', 'product'], name='marketplace_cart_id_caed36_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='cartitem',
            unique_together={('cart', 'product', 'variant')},
        ),
        migrations.AddIndex(
            model_name='stockmovement',
            index=models.Index(fields=['product', '-created_at'], name='marketplace_product_8641cc_idx'),
        ),
        migrations.AddIndex(
            model_name='stockmovement',
            index=models.Index(fields=['warehouse', '-created_at'], name='marketplace_warehou_52ad0e_idx'),
        ),
        migrations.AddIndex(
            model_name='stockmovement',
            index=models.Index(fields=['movement_type', '-created_at'], name='marketplace_movemen_d50ca2_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='subcategory',
            unique_together={('category', 'slug')},
        ),
        migrations.AlterUniqueTogether(
            name='variantattribute',
            unique_together={('variant', 'attribute_name')},
        ),
        migrations.AddIndex(
            model_name='vendor',
            index=models.Index(fields=['status', 'is_active'], name='marketplace_status_e8631e_idx'),
        ),
        migrations.AddIndex(
            model_name='orderitem',
            index=models.Index(fields=['order'], name='marketplace_order_i_86f595_idx'),
        ),
        migrations.AddIndex(
            model_name='orderitem',
            index=models.Index(fields=['product', '-id'], name='marketplace_product_5c4f32_idx'),
        ),
        migrations.AddIndex(
            model_name='orderitem',
            index=models.Index(fields=['item_status'], name='marketplace_item_st_fd3bec_idx'),
        ),
        migrations.AddIndex(
            model_name='orderitem',
            index=models.Index(fields=['vendor'], name='marketplace_vendor__cfa0ca_idx'),
        ),
        migrations.AddIndex(
            model_name='orderitem',
            index=models.Index(fields=['franchise_store'], name='marketplace_franchi_43b8da_idx'),
        ),
        migrations.AddIndex(
            model_name='fulfillmenttask',
            index=models.Index(fields=['assigned_to_vendor', 'status'], name='marketplace_assigne_3d4d9d_idx'),
        ),
        migrations.AddIndex(
            model_name='fulfillmenttask',
            index=models.Index(fields=['assigned_to_store', 'status'], name='marketplace_assigne_e5dd33_idx'),
        ),
        migrations.AddIndex(
            model_name='fulfillmenttask',
            index=models.Index(fields=['status', 'deadline'], name='marketplace_status_be2bb3_idx'),
        ),
        migrations.AddIndex(
            model_name='fulfillmentroute',
            index=models.Index(fields=['product', 'is_active'], name='marketplace_product_49d116_idx'),
        ),
        migrations.AddIndex(
            model_name='fulfillmentroute',
            index=models.Index(fields=['zone', 'fulfillment_mode'], name='marketplace_zone_id_e6400e_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='fulfillmentroute',
            unique_together={('product', 'zone', 'priority')},
        ),
        migrations.AddIndex(
            model_name='vendorcontract',
            index=models.Index(fields=['vendor', 'is_active'], name='marketplace_vendor__45bf0e_idx'),
        ),
        migrations.AddIndex(
            model_name='contractpricing',
            index=models.Index(fields=['product', 'pricing_tier', 'valid_until'], name='marketplace_product_c9b0a8_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='contractpricing',
            unique_together={('contract', 'product', 'pricing_tier', 'pincode', 'franchise_store')},
        ),
        migrations.AddIndex(
            model_name='vendorearning',
            index=models.Index(fields=['vendor', 'status'], name='marketplace_vendor__e2e30b_idx'),
        ),
        migrations.AddIndex(
            model_name='vendorearning',
            index=models.Index(fields=['status', 'created_at'], name='marketplace_status_83b045_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='vendorearning',
            unique_together={('vendor', 'order')},
        ),
        migrations.AddIndex(
            model_name='vendorinventory',
            index=models.Index(fields=['product', 'vendor'], name='marketplace_product_ed75e3_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='vendorinventory',
            unique_together={('vendor', 'product')},
        ),
        migrations.AddIndex(
            model_name='vendorpayout',
            index=models.Index(fields=['vendor', 'status'], name='marketplace_vendor__439cdd_idx'),
        ),
        migrations.AddIndex(
            model_name='warehousestock',
            index=models.Index(fields=['product', 'warehouse'], name='marketplace_product_b9676a_idx'),
        ),
        migrations.AddIndex(
            model_name='warehousestock',
            index=models.Index(fields=['warehouse', 'product'], name='marketplace_warehou_a8897f_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='warehousestock',
            unique_together={('warehouse', 'product')},
        ),
        migrations.AlterUniqueTogether(
            name='wishlistitem',
            unique_together={('wishlist', 'product')},
        ),
    ]
