# Generated by Django 5.1.2 on 2025-11-18 10:05

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


class Migration(migrations.Migration):

    dependencies = [
        ('account', '0033_shopmodel_commission_percent'),
        ('order', '0039_remove_cartitem_special_discount_amount'),
    ]

    operations = [
        migrations.CreateModel(
            name='ShopOrderModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('subtotal', models.BigIntegerField(default=0, verbose_name='جمع جزئیات')),
                ('items_count', models.PositiveIntegerField(default=0)),
                ('discount_amount', models.BigIntegerField(default=0, verbose_name='تخفیف اختصاصی فروشگاه')),
                ('special_discount_amount', models.BigIntegerField(default=0, verbose_name='تخفیف ویژه اختصاصی')),
                ('commission_percent', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='درصد کمیسیون')),
                ('commission_amount', models.BigIntegerField(default=0, verbose_name='مبلغ کمیسیون')),
                ('tax_amount', models.BigIntegerField(default=0, verbose_name='مالیات')),
                ('payable_amount', models.BigIntegerField(default=0, verbose_name='قابل پرداخت به فروشگاه')),
                ('is_settled', models.BooleanField(default=False, verbose_name='تسویه شده')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shop_orders', to='order.ordermodel')),
                ('shop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shop_orders', to='account.shopmodel')),
            ],
            options={
                'verbose_name': 'سفارش به ازای فروشگاه',
                'verbose_name_plural': 'سفارشات به ازای فروشگاه',
            },
        ),
        migrations.CreateModel(
            name='ShopOrderItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField()),
                ('unit_price', models.BigIntegerField()),
                ('total_price', models.BigIntegerField()),
                ('discount_amount', models.BigIntegerField(default=0)),
                ('special_discount_amount', models.BigIntegerField(default=0)),
                ('order_item', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='shop_items', to='order.orderitemmodel')),
                ('shop_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='order.shopordermodel')),
            ],
            options={
                'verbose_name': 'ایتم سفارش فروشگاه',
                'verbose_name_plural': 'ایتم های سفارش فروشگاه',
            },
        ),
        migrations.CreateModel(
            name='ShopDailyReport',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField()),
                ('total_sales', models.BigIntegerField(default=0)),
                ('total_commission', models.BigIntegerField(default=0)),
                ('total_payable', models.BigIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('shop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='daily_reports', to='account.shopmodel')),
            ],
            options={
                'verbose_name': 'گزارش روزانه فروشگاه',
                'verbose_name_plural': 'گزارش های روزانه فروشگاه',
                'unique_together': {('shop', 'date')},
            },
        ),
    ]
