# Generated by Django 5.0.5 on 2024-05-07 10:51

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


class Migration(migrations.Migration):

    dependencies = [
        ("django_admin_keycloak", "0005_keycloaksession"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="KeycloakUser",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "preferred_username",
                    models.CharField(max_length=128, verbose_name="username"),
                ),
                (
                    "given_name",
                    models.CharField(
                        blank=True, max_length=128, verbose_name="first name"
                    ),
                ),
                (
                    "family_name",
                    models.CharField(
                        blank=True, max_length=128, verbose_name="first name"
                    ),
                ),
                (
                    "email",
                    models.EmailField(
                        blank=True,
                        max_length=254,
                        null=True,
                        verbose_name="email address",
                    ),
                ),
                (
                    "email_verified",
                    models.BooleanField(default=False, verbose_name="email verified"),
                ),
                ("raw_data", models.JSONField()),
                (
                    "provider",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="users",
                        to="django_admin_keycloak.keycloakprovider",
                    ),
                ),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="keycloak_user",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Keycloak User",
                "verbose_name_plural": "Keycloak Users",
                "db_table": "keycloak_user",
            },
        ),
    ]
