# Generated by Django 4.1.8 on 2023-04-13 10:33

import uuid

import django.contrib.auth.models
import django.db.models.deletion
import django.utils.timezone
import wbcore.contrib.authentication.models
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("auth", "0012_alter_user_first_name_max_length"),
    ]

    operations = [
        migrations.CreateModel(
            name="User",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID"),
                ),
                ("password", models.CharField(max_length=128, verbose_name="password")),
                ("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")),
                (
                    "is_superuser",
                    models.BooleanField(
                        default=False,
                        help_text="Designates that this user has all permissions without explicitly assigning them.",
                        verbose_name="superuser status",
                    ),
                ),
                ("uuid", models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ("email", models.EmailField(max_length=254, unique=True, verbose_name="E-Mail")),
                ("username", models.CharField(max_length=255, unique=True, verbose_name="username")),
                (
                    "is_staff",
                    models.BooleanField(
                        default=False,
                        help_text="Specifies whether the user can log into this admin site.",
                        verbose_name="staff status",
                    ),
                ),
                (
                    "is_active",
                    models.BooleanField(
                        default=False,
                        help_text="Specifies whether this user should be treated as active. Unselect this instead of deleting accounts.",
                        verbose_name="active",
                    ),
                ),
                (
                    "is_register",
                    models.BooleanField(
                        default=True,
                        help_text="Specifies whether this user has registered its email. ",
                        verbose_name="register",
                    ),
                ),
                (
                    "date_joined",
                    models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined"),
                ),
                (
                    "groups",
                    models.ManyToManyField(
                        blank=True,
                        help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
                        related_name="user_set",
                        related_query_name="user",
                        to="auth.group",
                        verbose_name="groups",
                    ),
                ),
                (
                    "user_permissions",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Specific permissions for this user.",
                        related_name="user_set",
                        related_query_name="user",
                        to="auth.permission",
                        verbose_name="user permissions",
                    ),
                ),
            ],
            options={
                "verbose_name": "user",
                "verbose_name_plural": "users",
                "permissions": [
                    ("administrate_user", "Administrate Users"),
                    ("is_internal_user", "Internal User"),
                ],
                "swappable": "AUTH_USER_MODEL",
            },
            managers=[
                ("objects", wbcore.contrib.authentication.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name="Group",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("auth.group",),
            managers=[
                ("objects", django.contrib.auth.models.GroupManager()),
            ],
        ),
        migrations.CreateModel(
            name="Permission",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("auth.permission",),
            managers=[
                ("objects", django.contrib.auth.models.PermissionManager()),
            ],
        ),
        migrations.CreateModel(
            name="UserActivity",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID"),
                ),
                ("IP", models.GenericIPAddressField(blank=True, null=True)),
                ("date", models.DateTimeField(auto_now_add=True)),
                (
                    "status",
                    models.CharField(
                        blank=True,
                        choices=[("Success", "Success"), ("Failed", "Failed")],
                        default="Success",
                        max_length=8,
                        null=True,
                    ),
                ),
                ("jti", models.CharField(blank=True, default="", max_length=32)),
                (
                    "type",
                    models.CharField(
                        blank=True, choices=[("LOGIN", "Login")], default="LOGIN", max_length=16, null=True
                    ),
                ),
                ("user_agent_info", models.CharField(max_length=255)),
                ("latest_refresh", models.DateTimeField(blank=True, null=True)),
                (
                    "user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="login_activities",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "User Login Activity",
                "verbose_name_plural": "User Login Activities",
            },
        ),
    ]
