# Generated by Django 5.2.8 on 2025-11-15 15:42

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


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0103_countdowntimer_article_countdowntimer_is_published"),
    ]

    operations = [
        migrations.CreateModel(
            name="PasskeyCredential",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Friendly label shown on the security settings page.",
                        max_length=80,
                    ),
                ),
                (
                    "credential_id",
                    models.CharField(
                        help_text="Base64-encoded identifier returned by the authenticator.",
                        max_length=255,
                        unique=True,
                    ),
                ),
                ("public_key", models.BinaryField()),
                ("sign_count", models.PositiveIntegerField(default=0)),
                ("user_handle", models.CharField(max_length=255)),
                ("transports", models.JSONField(blank=True, default=list)),
                ("last_used_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="passkeys",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Passkey",
                "verbose_name_plural": "Passkeys",
                "ordering": ("name", "created_at"),
                "constraints": [
                    models.UniqueConstraint(
                        fields=("user", "name"),
                        name="core_passkey_unique_name_per_user",
                    )
                ],
            },
        ),
    ]
