# Generated by Django 6.0 on 2025-12-08 16:43

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('orders', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='SubscriptionPlan',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('plan_type', models.CharField(choices=[('FREE', 'Free - Commission Only'), ('BASIC', 'Basic Monthly'), ('PROFESSIONAL', 'Professional Monthly'), ('ENTERPRISE', 'Enterprise Monthly'), ('YEARLY_BASIC', 'Basic Yearly'), ('YEARLY_PRO', 'Professional Yearly')], max_length=20, unique=True)),
                ('description', models.TextField()),
                ('monthly_fee', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('yearly_fee', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('commission_rate', models.DecimalField(decimal_places=2, help_text='Commission percentage on each sale (0-100)', max_digits=5)),
                ('max_products', models.IntegerField(help_text='Maximum products allowed (-1 for unlimited)')),
                ('max_images_per_product', models.IntegerField(default=5)),
                ('can_use_ai_tools', models.BooleanField(default=False)),
                ('priority_support', models.BooleanField(default=False)),
                ('custom_store_url', models.BooleanField(default=False)),
                ('analytics_access', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'ordering': ['monthly_fee'],
            },
        ),
        migrations.CreateModel(
            name='Vendor',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('store_name', models.CharField(max_length=200, unique=True)),
                ('store_slug', models.SlugField(blank=True, max_length=200, unique=True)),
                ('store_description', models.TextField()),
                ('store_logo', models.ImageField(blank=True, null=True, upload_to='vendor_logos/')),
                ('store_banner', models.ImageField(blank=True, null=True, upload_to='vendor_banners/')),
                ('business_email', models.EmailField(max_length=254)),
                ('business_phone', models.CharField(max_length=20)),
                ('website', models.URLField(blank=True)),
                ('business_name', models.CharField(max_length=200)),
                ('business_type', models.CharField(max_length=100)),
                ('tax_id', models.CharField(blank=True, max_length=50)),
                ('address_line1', models.CharField(max_length=255)),
                ('address_line2', models.CharField(blank=True, max_length=255)),
                ('city', models.CharField(max_length=100)),
                ('state', models.CharField(max_length=100)),
                ('country', models.CharField(max_length=100)),
                ('postal_code', models.CharField(max_length=20)),
                ('subscription_start_date', models.DateTimeField(blank=True, null=True)),
                ('subscription_end_date', models.DateTimeField(blank=True, null=True)),
                ('bank_account_name', models.CharField(blank=True, max_length=200)),
                ('bank_account_number', models.CharField(blank=True, max_length=50)),
                ('bank_name', models.CharField(blank=True, max_length=100)),
                ('bank_routing_number', models.CharField(blank=True, max_length=50)),
                ('total_sales', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('total_orders', models.IntegerField(default=0)),
                ('rating', models.DecimalField(decimal_places=2, default=0, max_digits=3)),
                ('total_reviews', models.IntegerField(default=0)),
                ('status', models.CharField(choices=[('PENDING', 'Pending Approval'), ('ACTIVE', 'Active'), ('SUSPENDED', 'Suspended'), ('CLOSED', 'Closed')], default='PENDING', max_length=20)),
                ('is_verified', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('approved_at', models.DateTimeField(blank=True, null=True)),
                ('subscription_plan', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='vendors', to='vendors.subscriptionplan')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='vendor_profile', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='VendorCommission',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order_total', models.DecimalField(decimal_places=2, max_digits=10)),
                ('commission_rate', models.DecimalField(decimal_places=2, max_digits=5)),
                ('commission_amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('vendor_payout', models.DecimalField(decimal_places=2, max_digits=10)),
                ('is_paid', models.BooleanField(default=False)),
                ('paid_at', models.DateTimeField(blank=True, null=True)),
                ('payout_reference', models.CharField(blank=True, max_length=200)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vendor_commissions', to='orders.order')),
                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='commissions', to='vendors.vendor')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='VendorPayout',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('payment_method', models.CharField(default='Bank Transfer', max_length=50)),
                ('transaction_reference', models.CharField(blank=True, max_length=200)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PROCESSING', 'Processing'), ('COMPLETED', 'Completed'), ('FAILED', 'Failed')], default='PENDING', max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('processed_at', models.DateTimeField(blank=True, null=True)),
                ('completed_at', models.DateTimeField(blank=True, null=True)),
                ('notes', models.TextField(blank=True)),
                ('commissions', models.ManyToManyField(related_name='payout', to='vendors.vendorcommission')),
                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payouts', to='vendors.vendor')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='VendorSubscriptionPayment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('payment_method', models.CharField(max_length=50)),
                ('transaction_id', models.CharField(max_length=200, unique=True)),
                ('period_start', models.DateTimeField()),
                ('period_end', models.DateTimeField()),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PAID', 'Paid'), ('FAILED', 'Failed'), ('REFUNDED', 'Refunded')], default='PENDING', max_length=20)),
                ('paid_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('subscription_plan', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='vendors.subscriptionplan')),
                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscription_payments', to='vendors.vendor')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
    ]
