# Generated by Django 5.2.10 on 2026-01-31 22:23

import django.core.validators
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("cards", "0004_cardface_media_background"),
        ("users", "0002_totp"),
    ]

    operations = [
        migrations.AddField(
            model_name="user",
            name="login_rfid",
            field=models.ForeignKey(
                blank=True,
                help_text="RFID card assigned to this user for RFID logins.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="login_users",
                to="cards.rfid",
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="login_rfid_block",
            field=models.PositiveSmallIntegerField(
                blank=True,
                help_text="Data block number used for RFID login verification.",
                null=True,
                validators=[
                    django.core.validators.MinValueValidator(0),
                    django.core.validators.MaxValueValidator(63),
                ],
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="login_rfid_key",
            field=models.CharField(
                choices=[("A", "Key 1 (A)"), ("B", "Key 2 (B)")],
                default="A",
                help_text="Select which RFID key should be used to read the login data cell.",
                max_length=1,
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="login_rfid_offset",
            field=models.PositiveSmallIntegerField(
                blank=True,
                help_text="Byte offset within the data block (0-15).",
                null=True,
                validators=[
                    django.core.validators.MinValueValidator(0),
                    django.core.validators.MaxValueValidator(15),
                ],
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="login_rfid_value",
            field=models.CharField(
                blank=True,
                help_text="Hex value expected in the RFID data cell for login validation.",
                max_length=2,
                validators=[
                    django.core.validators.RegexValidator(
                        "^[0-9A-Fa-f]{2}$",
                        message="Login RFID value must be two hexadecimal digits.",
                    )
                ],
            ),
        ),
    ]
