"""User Model"""

# Django
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.db.models import EmailField
from django.utils.translation import gettext_lazy as _
from model_utils.models import UUIDModel, SoftDeletableModel

# Manager
from {{project_slug}}.users.models.managers import UserManager


class User(AbstractUser, UUIDModel, SoftDeletableModel):
    """
    Default custom user model.
    If adding fields.py that need to be filled at user signup,
    check serializer.SignupSerialzier.
    """

    email = EmailField(_("email address"), unique=True)

    USERNAME_FIELD = "username"
    REQUIRED_FIELDS = ["first_name", "last_name", "password"]

    is_verified = models.BooleanField(
        "verified",
        default=False,
        help_text="Set to true when the user have verified its email address.",
    )
    objects = UserManager()

    def __str__(self):
        """Return username."""
        return self.first_name + " " + self.last_name

    def get_short_name(self):
        """Return username."""
        return self.username + " " + self.last_name
