# Generated by Django 4.2.20 on 2025-06-23 11:12

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


class Migration(migrations.Migration):

    dependencies = [
        ('unicom', '0007_message_imap_uid'),
        ('unibot', '0003_encryptedcredential'),
    ]

    operations = [
        migrations.CreateModel(
            name='CredentialFieldDefinition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('key', models.CharField(max_length=255)),
                ('field_type', models.CharField(choices=[('text', 'Text'), ('email', 'Email'), ('number', 'Number'), ('phone', 'Phone Number'), ('password', 'Password'), ('pin', 'PIN')], default='text', max_length=20)),
                ('label', models.CharField(max_length=255)),
                ('help_text', models.TextField(blank=True)),
                ('placeholder', models.CharField(blank=True, max_length=255)),
                ('regex_pattern', models.CharField(blank=True, help_text='Optional regex pattern for validation', max_length=255)),
                ('min_length', models.IntegerField(blank=True, null=True)),
                ('max_length', models.IntegerField(blank=True, null=True)),
                ('required', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=0)),
            ],
            options={
                'ordering': ['order', 'key'],
            },
        ),
        migrations.RenameField(
            model_name='encryptedcredential',
            old_name='encrypted_value',
            new_name='value',
        ),
        migrations.CreateModel(
            name='CredentialSetupSession',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('expires_at', models.DateTimeField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('completed_at', models.DateTimeField(blank=True, null=True)),
                ('max_attempts', models.IntegerField(default=3)),
                ('attempts', models.IntegerField(default=0)),
                ('metadata', models.JSONField(blank=True, default=dict)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='unicom.account')),
                ('field_definitions', models.ManyToManyField(to='unibot.credentialfielddefinition')),
            ],
        ),
    ]
