# Generated by Django 5.2.7 on 2026-03-07 20:12

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0041_useraccessibilitysettings'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserXmppOmemoTrustedKey',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('jid', models.CharField(blank=True, default='', max_length=255)),
                ('key_type', models.CharField(choices=[('fingerprint', 'Fingerprint'), ('client_key', 'Client key')], default='fingerprint', max_length=32)),
                ('key_id', models.CharField(max_length=255)),
                ('trusted', models.BooleanField(default=False)),
                ('source', models.CharField(blank=True, default='', max_length=64)),
                ('last_seen_at', models.DateTimeField(blank=True, 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='xmpp_omemo_trusted_keys', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'indexes': [
                    models.Index(fields=['user', 'trusted', 'updated_at'], name='core_userxomemo_trusted_idx'),
                    models.Index(fields=['user', 'jid', 'updated_at'], name='core_userxomemo_jid_idx'),
                ],
                'constraints': [
                    models.UniqueConstraint(fields=('user', 'jid', 'key_type', 'key_id'), name='unique_user_xmpp_omemo_trusted_key'),
                ],
            },
        ),
    ]
