# Generated by Django 5.2.3 on 2025-07-06 18:09

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 = [
        ('accounts', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='EmailVerificationToken',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('token', models.CharField(help_text='Email verification token', max_length=100, unique=True, verbose_name='Token')),
                ('email', models.EmailField(help_text='Email address to verify', max_length=254, verbose_name='Email')),
                ('expires_at', models.DateTimeField(help_text='When the token expires', verbose_name='Expires At')),
                ('is_used', models.BooleanField(default=False, help_text='Whether the token has been used', verbose_name='Is Used')),
                ('used_at', models.DateTimeField(blank=True, help_text='When the token was used', null=True, verbose_name='Used At')),
                ('verified_ip', models.GenericIPAddressField(blank=True, help_text='IP address from which email was verified', null=True, verbose_name='Verified IP')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to='accounts.user')),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to='accounts.user')),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to='accounts.user')),
                ('user', models.ForeignKey(help_text='User for whom the verification token is generated', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'Email Verification Token',
                'verbose_name_plural': 'Email Verification Tokens',
                'db_table': 'auth_email_verification_token',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['token'], name='auth_email__token_8cba8c_idx'), models.Index(fields=['user', 'is_used'], name='auth_email__user_id_b82b9d_idx'), models.Index(fields=['email'], name='auth_email__email_be6600_idx')],
            },
        ),
        migrations.CreateModel(
            name='LoginAttempt',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('attempted_email', models.EmailField(help_text='Email address used in login attempt', max_length=254, verbose_name='Attempted Email')),
                ('ip_address', models.GenericIPAddressField(help_text='IP address from which login was attempted', verbose_name='IP Address')),
                ('user_agent', models.TextField(blank=True, help_text='Browser/client user agent string', verbose_name='User Agent')),
                ('is_successful', models.BooleanField(default=False, help_text='Whether the login attempt was successful', verbose_name='Is Successful')),
                ('failure_reason', models.CharField(blank=True, help_text='Reason for login failure', max_length=100, verbose_name='Failure Reason')),
                ('country', models.CharField(blank=True, help_text='Country from which login was attempted', max_length=100, verbose_name='Country')),
                ('city', models.CharField(blank=True, help_text='City from which login was attempted', max_length=100, verbose_name='City')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to='accounts.user')),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to='accounts.user')),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to='accounts.user')),
                ('user', models.ForeignKey(blank=True, help_text='User who attempted to login', null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'Login Attempt',
                'verbose_name_plural': 'Login Attempts',
                'db_table': 'auth_login_attempt',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['attempted_email', 'created_at'], name='auth_login__attempt_fcb801_idx'), models.Index(fields=['ip_address', 'created_at'], name='auth_login__ip_addr_b3ce76_idx'), models.Index(fields=['is_successful', 'created_at'], name='auth_login__is_succ_d07187_idx')],
            },
        ),
        migrations.CreateModel(
            name='PasswordResetToken',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('token', models.CharField(help_text='Password reset token', max_length=100, unique=True, verbose_name='Token')),
                ('expires_at', models.DateTimeField(help_text='When the token expires', verbose_name='Expires At')),
                ('is_used', models.BooleanField(default=False, help_text='Whether the token has been used', verbose_name='Is Used')),
                ('used_at', models.DateTimeField(blank=True, help_text='When the token was used', null=True, verbose_name='Used At')),
                ('requested_ip', models.GenericIPAddressField(help_text='IP address from which reset was requested', verbose_name='Requested IP')),
                ('used_ip', models.GenericIPAddressField(blank=True, help_text='IP address from which token was used', null=True, verbose_name='Used IP')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to='accounts.user')),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to='accounts.user')),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to='accounts.user')),
                ('user', models.ForeignKey(help_text='User for whom the token is generated', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'Password Reset Token',
                'verbose_name_plural': 'Password Reset Tokens',
                'db_table': 'auth_password_reset_token',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['token'], name='auth_passwo_token_ceb1cb_idx'), models.Index(fields=['user', 'is_used'], name='auth_passwo_user_id_7ffbe2_idx'), models.Index(fields=['expires_at'], name='auth_passwo_expires_1116e7_idx')],
            },
        ),
        migrations.CreateModel(
            name='UserSession',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('session_key', models.CharField(help_text='Django session key', max_length=40, unique=True, verbose_name='Session Key')),
                ('ip_address', models.GenericIPAddressField(help_text='IP address of the session', verbose_name='IP Address')),
                ('user_agent', models.TextField(blank=True, help_text='Browser/client user agent string', verbose_name='User Agent')),
                ('device_type', models.CharField(blank=True, help_text='Type of device (mobile, desktop, tablet)', max_length=50, verbose_name='Device Type')),
                ('browser', models.CharField(blank=True, help_text='Browser name and version', max_length=100, verbose_name='Browser')),
                ('operating_system', models.CharField(blank=True, help_text='Operating system name and version', max_length=100, verbose_name='Operating System')),
                ('is_active', models.BooleanField(default=True, help_text='Whether the session is currently active', verbose_name='Is Active')),
                ('last_activity', models.DateTimeField(auto_now=True, help_text='When the session was last active', verbose_name='Last Activity')),
                ('expires_at', models.DateTimeField(help_text='When the session expires', verbose_name='Expires At')),
                ('country', models.CharField(blank=True, help_text='Country of the session', max_length=100, verbose_name='Country')),
                ('city', models.CharField(blank=True, help_text='City of the session', max_length=100, verbose_name='City')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to='accounts.user')),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to='accounts.user')),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to='accounts.user')),
                ('user', models.ForeignKey(help_text='User who owns this session', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'User Session',
                'verbose_name_plural': 'User Sessions',
                'db_table': 'auth_user_session',
                'ordering': ['-last_activity'],
                'indexes': [models.Index(fields=['user', 'is_active'], name='auth_user_s_user_id_be2038_idx'), models.Index(fields=['session_key'], name='auth_user_s_session_939fd1_idx'), models.Index(fields=['last_activity'], name='auth_user_s_last_ac_b4f4ce_idx')],
            },
        ),
    ]
