# Generated by Django 5.2.8 on 2025-11-30 22:04

import authentik.lib.utils.time
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        (
            "authentik_endpoints_connectors_agent",
            "0002_deviceauthenticationtoken_alter_devicetoken_options_and_more",
        ),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="agentconnector",
            name="auth_session_duration",
            field=models.TextField(
                default="hours=8", validators=[authentik.lib.utils.time.timedelta_string_validator]
            ),
        ),
        migrations.AddField(
            model_name="deviceauthenticationtoken",
            name="user",
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.CreateModel(
            name="AppleNonce",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("expires", models.DateTimeField(default=None, null=True)),
                ("expiring", models.BooleanField(default=True)),
                ("nonce", models.TextField()),
                (
                    "device_token",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="authentik_endpoints_connectors_agent.devicetoken",
                    ),
                ),
            ],
            options={
                "verbose_name": "Apple Nonce",
                "verbose_name_plural": "Apple Nonces",
                "abstract": False,
                "indexes": [
                    models.Index(fields=["expires"], name="authentik_e_expires_e5d275_idx"),
                    models.Index(fields=["expiring"], name="authentik_e_expirin_0b4d8e_idx"),
                    models.Index(
                        fields=["expiring", "expires"], name="authentik_e_expirin_355561_idx"
                    ),
                ],
            },
        ),
    ]
