# Generated by Django 5.2.8 on 2025-11-25 03:30

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


class Migration(migrations.Migration):

    dependencies = [
        ('sales', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='PaymentTransaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('payment_method', models.CharField(choices=[('cash', 'Cash'), ('transfer', 'Bank Transfer'), ('pos', 'POS/ATM Card'), ('mobile_money', 'Mobile Money'), ('credit', 'Credit'), ('paystack', 'Paystack'), ('flutterwave', 'Flutterwave')], max_length=20)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('reference_number', models.CharField(blank=True, help_text='Payment reference from gateway', max_length=100)),
                ('transaction_id', models.CharField(blank=True, help_text='Gateway transaction ID', max_length=100)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('completed', 'Completed'), ('failed', 'Failed'), ('cancelled', 'Cancelled')], default='pending', max_length=15)),
                ('gateway_response', models.JSONField(blank=True, default=dict, help_text='Full gateway response')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='sales.posorder')),
            ],
            options={
                'verbose_name': 'Payment Transaction',
                'verbose_name_plural': 'Payment Transactions',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='SaleSummary',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField()),
                ('total_sales', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('total_transactions', models.PositiveIntegerField(default=0)),
                ('cash_sales', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('transfer_sales', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('pos_sales', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('mobile_money_sales', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('cash_transactions', models.PositiveIntegerField(default=0)),
                ('transfer_transactions', models.PositiveIntegerField(default=0)),
                ('pos_transactions', models.PositiveIntegerField(default=0)),
                ('mobile_money_transactions', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Sale Summary',
                'verbose_name_plural': 'Sale Summaries',
                'ordering': ['-date'],
                'unique_together': {('date',)},
            },
        ),
    ]
