""""Profile model."""

#django
from django.db import models

#Utilities
from cride.utils.models import CRideModel

class Profile(CRideModel):
    """Profile model
    A profile holds a user's public data like biography, picture
    and statistics
    """
    user = models.OneToOneField('users.User', on_delete=models.CASCADE)
    picture = models.ImageField(
        'profile_picture',
        upload_to='users/pictures/',
        blank=True,
        null=True,
    )
    biography= models.TextField(max_length=500, blank=True)
    
    #stats
    rides_taken = models.PositiveIntegerField(default=0)
    rides_offered = models.PositiveIntegerField(default=0)
    reputation = models.FloatField(
        default=5.0,
        help_text="User's reputations based on the ride taken and ofered"
    )

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