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

class UserProfile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    email = models.EmailField(unique=True) 
    password = models.CharField(max_length=255)
    phone_number = models.CharField(max_length=15)
    li_phy_card_identifier = models.CharField(max_length=20)
    email_otp = models.CharField(max_length=6, blank=True, null=True)
    mobile_code = models.CharField(max_length=50, null=True)
    country = models.CharField(max_length=50,null=True)
    state = models.CharField(max_length=50,null=True)
    postal_code = models.CharField(max_length=10,null=True)
    full_address = models.TextField(null=True)
    company_name = models.CharField(max_length=100,blank=True, null=True)

    def get_user_id(self):
        return self.user.id  # Access the user ID

    def __str__(self):
        return f"{self.email}-{self.user.id}"