"""Profile model."""

# Django
from django.db import models
from model_utils.models import UUIDModel, SoftDeletableModel

# Utilities
from {{project_slug}}.utils.regexs import phone_regex


class Profile(UUIDModel, SoftDeletableModel):
    """Profile model.
    A profile holds a user's public data.
    """

    GENDERS = [
        ("F", "Feminine"),
        ("M", "Masculine"),
        ("O", "Other"),
        ("R", "Rather not to say"),
    ]

    user = models.OneToOneField(
        "users.User", related_name="profile", on_delete=models.CASCADE
    )
    phone_number = models.CharField(
        validators=[phone_regex],
        max_length=17,
        help_text="Example: +584121234567",
        null=True,
        blank=True,
    )
    age = models.PositiveSmallIntegerField(null=True, blank=True)
    gender = models.CharField(max_length=1, choices=GENDERS, default="O")

    def __str__(self):
        """Return user's str representation."""
        return str(self.user)
