# Generated by Django 3.2.25 on 2026-01-14 00:00

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ImportLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('importer_class', models.CharField(max_length=255, verbose_name='Clase Importadora')),
                ('importer_name', models.CharField(max_length=255, verbose_name='Nombre del Importador')),
                ('file_format', models.CharField(choices=[('xlsx', 'Excel (XLSX)'), ('csv', 'CSV'), ('json', 'JSON')], max_length=10, verbose_name='Formato')),
                ('uploaded_file', models.FileField(upload_to='imports/%Y/%m/%d/', verbose_name='Archivo')),
                ('status', models.CharField(choices=[('pending', 'Pendiente'), ('processing', 'Procesando'), ('success', 'Exitoso'), ('partial', 'Parcial'), ('failed', 'Fallido')], default='pending', max_length=20, verbose_name='Estado')),
                ('total_rows', models.IntegerField(default=0, verbose_name='Total de Filas')),
                ('processed_rows', models.IntegerField(default=0, verbose_name='Filas Procesadas')),
                ('success_rows', models.IntegerField(default=0, verbose_name='Filas Exitosas')),
                ('error_rows', models.IntegerField(default=0, verbose_name='Filas con Error')),
                ('error_details', models.JSONField(blank=True, default=list, verbose_name='Detalles de Errores')),
                ('progress_log', models.JSONField(blank=True, default=list, verbose_name='Log de Progreso')),
                ('result_message', models.TextField(blank=True, verbose_name='Mensaje de Resultado')),
                ('can_re_run', models.BooleanField(default=False, verbose_name='Puede Re-ejecutarse')),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Fecha de Creación')),
                ('started_at', models.DateTimeField(blank=True, null=True, verbose_name='Fecha de Inicio')),
                ('completed_at', models.DateTimeField(blank=True, null=True, verbose_name='Fecha de Finalización')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Creado por')),
            ],
            options={
                'verbose_name': 'Bitácora de Importación',
                'verbose_name_plural': 'Bitácoras de Importación',
                'ordering': ['-created_at'],
            },
        ),
    ]
