# Generated by Django 5.2 on 2025-07-26 19:36

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0066_uniq_free_plan_block_per_month'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='UserPhoneNumber',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('phone_number', models.CharField(max_length=32, unique=True, validators=[django.core.validators.RegexValidator(message='Phone number must be in E.164 format (e.g., +1234567890)', regex='^\\+?[1-9]\\d{1,14}$')])),
                ('is_primary', models.BooleanField(default=False)),
                ('is_verified', models.BooleanField(default=False)),
                ('verified_at', models.DateTimeField(blank=True, null=True)),
                ('verification_sid', models.CharField(blank=True, max_length=64, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='phone_numbers', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
                'constraints': [models.UniqueConstraint(condition=models.Q(('is_primary', True)), fields=('user',), name='uniq_primary_phone_per_user'), models.CheckConstraint(condition=models.Q(('phone_number__regex', '^\\+?[1-9]\\d{1,14}$')), name='chk_e164_user_phone')],
            },
        ),
    ]
