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


class Migration(migrations.Migration):

    dependencies = [
        ('accounts', '0027_shipper_business_name_tax_id'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='PasswordResetOTP',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(max_length=254)),
                ('otp', models.CharField(max_length=10)),
                ('token', models.CharField(blank=True, default='', max_length=64)),
                ('is_used', models.BooleanField(default=False)),
                ('attempts', models.PositiveIntegerField(default=0)),
                ('expires_at', models.DateTimeField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='password_reset_otps', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Password reset OTP',
                'verbose_name_plural': 'Password reset OTPs',
                'ordering': ['-created_at'],
                'indexes': [
                    models.Index(fields=['email', 'otp', 'is_used'], name='accounts_pa_email_6ff4e0_idx'),
                    models.Index(fields=['token', 'is_used'], name='accounts_pa_token_e6d425_idx'),
                ],
            },
        ),
    ]
