# Generated by Django 5.2.14 on 2026-08-25 17:14

import django.db.models.deletion
import simple_history.models
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='HistoricalPayment',
            fields=[
                ('id', models.IntegerField(blank=True, db_index=True)),
                ('is_deleted', models.BooleanField(default=False, verbose_name='Eliminado')),
                ('created_at', models.DateField(blank=True, editable=False, verbose_name='Fecha de Creación')),
                ('updated_at', models.DateField(blank=True, editable=False, verbose_name='Fecha de Modificación')),
                ('deleted_at', models.DateField(blank=True, null=True, verbose_name='Fecha de Eliminación')),
                ('payment_stage', models.CharField(choices=[('initial', 'Pago inicial'), ('final', 'Pago final')], help_text='Indica si es el pago inicial o el pago final', max_length=10, verbose_name='Etapa del pago')),
                ('amount', models.DecimalField(decimal_places=2, help_text='Monto que el cliente indica haber transferido/pagado', max_digits=12, verbose_name='Monto pagado')),
                ('payment_method', models.CharField(choices=[('transfer', 'Transferencia bancaria'), ('cash', 'Efectivo'), ('mobile_payment', 'Pago móvil'), ('other', 'Otro')], default='transfer', max_length=20, verbose_name='Método de pago')),
                ('status', models.CharField(choices=[('pending', 'Pendiente de revisión'), ('approved', 'Aprobado'), ('rejected', 'Rechazado')], default='pending', max_length=10, verbose_name='Estado')),
                ('reference_number', models.CharField(blank=True, help_text='Número de referencia bancaria o comprobante de pago', max_length=100, null=True, verbose_name='Número de referencia')),
                ('receipt_file', models.TextField(blank=True, help_text='Imagen o PDF del comprobante de pago', max_length=100, null=True, verbose_name='Comprobante de pago')),
                ('notes', models.TextField(blank=True, help_text='Observaciones adicionales sobre el pago', null=True, verbose_name='Notas')),
                ('reviewed_at', models.DateTimeField(blank=True, null=True, verbose_name='Fecha de revisión')),
                ('rejection_reason', models.TextField(blank=True, help_text='Razón por la que el pago fue rechazado', null=True, verbose_name='Motivo de rechazo')),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField(db_index=True)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('order', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='orders.order', verbose_name='Pedido')),
                ('reviewed_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Revisado por')),
            ],
            options={
                'verbose_name': 'historical Pago',
                'verbose_name_plural': 'historical Pagos',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, verbose_name='Eliminado')),
                ('created_at', models.DateField(auto_now_add=True, verbose_name='Fecha de Creación')),
                ('updated_at', models.DateField(auto_now=True, verbose_name='Fecha de Modificación')),
                ('deleted_at', models.DateField(blank=True, null=True, verbose_name='Fecha de Eliminación')),
                ('payment_stage', models.CharField(choices=[('initial', 'Pago inicial'), ('final', 'Pago final')], help_text='Indica si es el pago inicial o el pago final', max_length=10, verbose_name='Etapa del pago')),
                ('amount', models.DecimalField(decimal_places=2, help_text='Monto que el cliente indica haber transferido/pagado', max_digits=12, verbose_name='Monto pagado')),
                ('payment_method', models.CharField(choices=[('transfer', 'Transferencia bancaria'), ('cash', 'Efectivo'), ('mobile_payment', 'Pago móvil'), ('other', 'Otro')], default='transfer', max_length=20, verbose_name='Método de pago')),
                ('status', models.CharField(choices=[('pending', 'Pendiente de revisión'), ('approved', 'Aprobado'), ('rejected', 'Rechazado')], default='pending', max_length=10, verbose_name='Estado')),
                ('reference_number', models.CharField(blank=True, help_text='Número de referencia bancaria o comprobante de pago', max_length=100, null=True, verbose_name='Número de referencia')),
                ('receipt_file', models.FileField(blank=True, help_text='Imagen o PDF del comprobante de pago', null=True, upload_to='payments/receipts/', verbose_name='Comprobante de pago')),
                ('notes', models.TextField(blank=True, help_text='Observaciones adicionales sobre el pago', null=True, verbose_name='Notas')),
                ('reviewed_at', models.DateTimeField(blank=True, null=True, verbose_name='Fecha de revisión')),
                ('rejection_reason', models.TextField(blank=True, help_text='Razón por la que el pago fue rechazado', null=True, verbose_name='Motivo de rechazo')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='orders.order', verbose_name='Pedido')),
                ('reviewed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_payments', to=settings.AUTH_USER_MODEL, verbose_name='Revisado por')),
            ],
            options={
                'verbose_name': 'Pago',
                'verbose_name_plural': 'Pagos',
                'ordering': ['-created_at'],
            },
        ),
    ]
