from django.contrib.auth import get_user_model
from django.db import models
from django_extensions.db.models import TimeStampedModel

User = get_user_model()
BNULL = {"blank": True, "null": True}


class Person(TimeStampedModel):
    """A non-system user model that can be optionally associated with a User."""

    user = models.ForeignKey(User, on_delete=models.DO_NOTHING, **BNULL)
    name = models.CharField(max_length=100, **BNULL)
    bgstats_id = models.UUIDField(**BNULL)
    bgg_username = models.CharField(max_length=100, **BNULL)
    lichess_username = models.CharField(max_length=100, **BNULL)
    bio = models.TextField(**BNULL)

    def __str__(self):
        return self.name
