# Generated by Django 5.2.5 on 2025-08-30 09:50

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


class Migration(migrations.Migration):

    dependencies = [
        ('django_myuser', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AuditLog',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('event_type', models.CharField(choices=[('LOGIN', 'Login'), ('LOGOUT', 'Logout'), ('LOGIN_FAILED', 'Login Failed'), ('PASSWORD_CHANGE', 'Password Change'), ('PASSWORD_RESET', 'Password Reset'), ('ACCOUNT_CREATED', 'Account Created'), ('ACCOUNT_DELETED', 'Account Deleted'), ('PROFILE_UPDATE', 'Profile Update'), ('SOCIAL_ACCOUNT_CONNECTED', 'Social Account Connected'), ('SOCIAL_ACCOUNT_DISCONNECTED', 'Social Account Disconnected'), ('DATA_EXPORT_REQUESTED', 'Data Export Requested'), ('DATA_DELETE_REQUESTED', 'Data Delete Requested'), ('EMAIL_CONFIRMED', 'Email Confirmed'), ('SUSPICIOUS_ACTIVITY', 'Suspicious Activity')], max_length=30)),
                ('ip_address', models.GenericIPAddressField(blank=True, null=True)),
                ('user_agent', models.CharField(blank=True, max_length=255)),
                ('extra_data', models.JSONField(blank=True, help_text='Additional event-specific data stored as JSON', null=True)),
                ('description', models.TextField(blank=True, help_text='Human-readable description of the event')),
                ('user', models.ForeignKey(blank=True, help_text='User associated with the event (null for anonymous events)', null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['user', '-created_at'], name='django_myus_user_id_aacf6b_idx'), models.Index(fields=['event_type', '-created_at'], name='django_myus_event_t_2ea4a4_idx'), models.Index(fields=['ip_address', '-created_at'], name='django_myus_ip_addr_bbc8d6_idx')],
            },
        ),
    ]
