from django.db import models

class Profile(models.Model):
    """Stores user profile information for the SnapStyle app."""

    # Section 1: Basic Info
    full_name = models.CharField(max_length=255)
    display_name = models.CharField(max_length=255, blank=True)
    country = models.CharField(max_length=100)

    # Section 2: Body Info
    height_cm = models.PositiveIntegerField(null=True, blank=True)
    weight_kg = models.PositiveIntegerField(null=True, blank=True)
    
    # Gender is for fit style, not identity
    GENDER_CHOICES = [
        ('WOMEN', "Women's"),
        ('MEN', "Men's"),
        ('UNISEX', 'Unisex'),
        ('CUSTOM', 'Custom'),
    ]
    gender_fit_style = models.CharField(max_length=10, choices=GENDER_CHOICES, blank=True)

    # Section 3: Sizes
    TOP_SIZE_CHOICES = [
        ('XS', 'XS'),
        ('S', 'S'),
        ('M', 'M'),
        ('L', 'L'),
        ('XL', 'XL'),
        ('XXL', 'XXL'),
        ('OTHER', 'Other'),
    ]
    top_size = models.CharField(max_length=5, choices=TOP_SIZE_CHOICES)
    bottom_size = models.CharField(max_length=20)
    shoe_size = models.CharField(max_length=20, blank=True)

    # Section 4: Style preferences
    favorite_colors = models.JSONField(default=list)
    favorite_categories = models.JSONField(default=list)
    
    BUDGET_CHOICES = [
        ('LOW', 'Low'),
        ('MEDIUM', 'Medium'),
        ('HIGH', 'High'),
    ]
    budget_level = models.CharField(max_length=10, choices=BUDGET_CHOICES)

    # Verification & Timestamps
    instagram_handle = models.CharField(max_length=255, blank=True)
    verification_level = models.CharField(max_length=20, default='NONE')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.full_name or f"Profile {self.id}"

