# Generated by Django 6.1 on 2026-08-19 01:39

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 = [
        ('domains', '0002_domain_access_error_code'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Notification',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('kind', models.CharField(choices=[('BATCH_FINISHED', 'Un lote terminó'), ('BATCH_FAILED', 'Un lote falló'), ('ACCESS_LOST', 'Se perdió el acceso a una propiedad'), ('CREDENTIAL_INVALID', 'La credencial dejó de servir'), ('COVERAGE_DROP', 'URLs que dejaron de estar indexadas')], max_length=30)),
                ('level', models.CharField(choices=[('INFO', 'Para saber'), ('ACTION', 'Necesita una acción')], default='INFO', max_length=10)),
                ('title', models.CharField(max_length=200)),
                ('body', models.TextField(blank=True, default='')),
                ('action_path', models.CharField(blank=True, default='', max_length=255)),
                ('action_label', models.CharField(blank=True, default='', max_length=60)),
                ('dedupe_key', models.CharField(max_length=255)),
                ('read_at', models.DateTimeField(blank=True, null=True)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL)),
                ('domain', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to='domains.domain')),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['account', 'read_at'], name='notificatio_account_f67211_idx')],
                'constraints': [models.UniqueConstraint(fields=('account', 'dedupe_key'), name='un_aviso_por_hecho_y_cuenta')],
            },
        ),
    ]
