from django.contrib.auth.models import AbstractUser
from django.db import models
from django.db.models import JSONField


class User(AbstractUser):
    """
    Default custom user model for VBV Lernwelt.
    If adding fields that need to be filled at user signup,
    """

    LANGUAGE_CHOICES = (
        ("de", "Deutsch"),
        ("fr", "Français"),
        ("it", "Italiano"),
    )

    # FIXME: look into it...
    # objects = UserManager()
    avatar_url = models.CharField(
        max_length=254, blank=True, default="/static/avatars/myvbv-default-avatar.png"
    )
    email = models.EmailField("email address", unique=True)
    sso_id = models.UUIDField(
        "SSO subscriber ID", unique=True, null=True, blank=True, default=None
    )
    additional_json_data = JSONField(default=dict, blank=True)
    language = models.CharField(max_length=2, choices=LANGUAGE_CHOICES, default="de")


class SecurityRequestResponseLog(models.Model):
    label = models.CharField(max_length=255, blank=True, default="")

    request_method = models.CharField(max_length=255, blank=True, default="")
    request_full_path = models.CharField(max_length=255, blank=True, default="")
    request_username = models.CharField(max_length=255, blank=True, default="")
    request_client_ip = models.CharField(max_length=255, blank=True, default="")

    response_status_code = models.CharField(max_length=255, blank=True, default="")

    additional_json_data = JSONField(default=dict, blank=True)
