# Generated by Django 5.2.12 on 2026-03-29 17:48

import django.db.models.deletion
import mojo.models.rest
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('account', '0037_geolocatedip_block_count_geolocatedip_blocked_until_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserLoginEvent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip_address', models.GenericIPAddressField(db_index=True)),
                ('country_code', models.CharField(blank=True, db_index=True, max_length=3, null=True)),
                ('region', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('city', models.CharField(blank=True, max_length=100, null=True)),
                ('latitude', models.FloatField(blank=True, null=True)),
                ('longitude', models.FloatField(blank=True, null=True)),
                ('source', models.CharField(blank=True, db_index=True, default='', max_length=32)),
                ('user_agent_info', models.JSONField(blank=True, default=dict)),
                ('is_new_country', models.BooleanField(db_index=True, default=False)),
                ('is_new_region', models.BooleanField(db_index=True, default=False)),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified', models.DateTimeField(auto_now=True, db_index=True)),
                ('device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='login_events', to='account.userdevice')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='login_events', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created'],
                'indexes': [models.Index(fields=['user', 'country_code'], name='account_use_user_id_aafcec_idx'), models.Index(fields=['user', 'country_code', 'region'], name='account_use_user_id_2bfc8f_idx')],
            },
            bases=(models.Model, mojo.models.rest.MojoModel),
        ),
    ]
