"""User Account models"""

# Django
from django.db import models

# Utils
from models import PLModel


class Account(PLModel):
    """Account model."""

    user = models.OneToOneField(
        "users.User", related_name="account", on_delete=models.CASCADE
    )
    account_number = models.CharField(max_length=10, unique=True)
    balance = models.DecimalField(max_digits=7, decimal_places=2)

    last_balance_updated = models.DateTimeField()

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