# Generated by Django 5.2.15 on 2026-06-15 15:30

import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='DatabaseCleanupOperation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='Código')),
                ('mode', models.CharField(choices=[('selective', 'Eliminação seletiva'), ('full', 'Limpeza total do portal')], max_length=20, verbose_name='Modo')),
                ('status', models.CharField(choices=[('previewed', 'Pré-visualizada'), ('running', 'Em execução'), ('completed', 'Concluída'), ('failed', 'Falhou'), ('cancelled', 'Cancelada')], db_index=True, default='previewed', max_length=20, verbose_name='Estado')),
                ('selected_groups', models.JSONField(blank=True, default=list, verbose_name='Grupos selecionados')),
                ('effective_groups', models.JSONField(blank=True, default=list, verbose_name='Grupos efetivos')),
                ('options', models.JSONField(blank=True, default=dict, verbose_name='Opções')),
                ('preview', models.JSONField(blank=True, default=dict, verbose_name='Pré-visualização')),
                ('result', models.JSONField(blank=True, default=dict, verbose_name='Resultado')),
                ('backup_path', models.CharField(blank=True, max_length=500, verbose_name='Cópia de segurança')),
                ('error_message', models.TextField(blank=True, verbose_name='Erro')),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Criado em')),
                ('started_at', models.DateTimeField(blank=True, null=True, verbose_name='Iniciado em')),
                ('completed_at', models.DateTimeField(blank=True, null=True, verbose_name='Concluído em')),
                ('requested_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='database_cleanup_operations', to=settings.AUTH_USER_MODEL, verbose_name='Solicitado por')),
            ],
            options={
                'verbose_name': 'Operação de limpeza',
                'verbose_name_plural': 'Operações de limpeza',
                'ordering': ['-created_at'],
            },
        ),
    ]
