from django.contrib.auth.models import AbstractUser
from django.db import models

class BaseUser(AbstractUser):
    # Additional fields to extend the default user model
    
    # Profile-related fields
    image = models.ImageField(upload_to='user_profiles/', blank=True, null=True)
    bio = models.TextField(blank=True, null=True)
    address = models.TextField(blank=True, null=True)
    contact_number = models.CharField(max_length=15, blank=True, null=True)
    citizenship = models.CharField(max_length=100, blank=True, null=True)
    certificate = models.FileField(upload_to='certificates/', blank=True, null=True)
    
    # Verification and status
    is_verified = models.BooleanField(default=False)
    
    # Financial or business-related fields
    price = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True)
    ratings = models.DecimalField(max_digits=3, decimal_places=2, default=0.00)
    
    # Role and other identifiers
    role = models.CharField(
        max_length=50, 
        choices=[('CLIENT', 'CLIENT'), ('ADMIN', 'ADMIN'), ('SERVICE_PROVIDER', 'SERVICE_PROVIDER')],
        default='CLIENT'
    )
    
    # Time-related fields
    member_since = models.DateTimeField(auto_now_add=True)
    profile_updated = models.DateTimeField(auto_now=True)
    
    # Token field for verification or authentication purposes
    token = models.CharField(max_length=256, blank=True, null=True)
    
    def __str__(self):
        return self.username
    
    class Meta:
        verbose_name = 'Base User'
        verbose_name_plural = 'Base Users'
