from django.db import models

class Skill(models.Model):
    name = models.CharField(max_length=255, unique=True)
    description = models.TextField(blank=True, null=True)
    proficiency_levels = models.JSONField(blank=True, null=True) # e.g., ["Beginner", "Intermediate", "Advanced"]
    related_jobs = models.JSONField(blank=True, null=True) # e.g., ["Software Engineer", "Data Scientist"]

    def __str__(self):
        return self.name

class CareerPath(models.Model):
    title = models.CharField(max_length=255, unique=True)
    description = models.TextField(blank=True, null=True)
    required_skills = models.ManyToManyField(Skill, related_name='career_paths') # Many-to-Many relationship with Skill
    typical_roles = models.JSONField(blank=True, null=True) # e.g., ["Junior Developer", "Senior Developer"]
    clusters = models.JSONField(blank=True, null=True) # e.g., ["Software Development", "AI/ML"]
    salary_range = models.CharField(max_length=255, blank=True, null=True) # e.g., "$50k - $80k"
    growth_trends = models.TextField(blank=True, null=True)
    sample_roadmap_id = models.CharField(max_length=255, blank=True, null=True) # Reference to a roadmap

    def __str__(self):
        return self.title


from django.contrib.auth import get_user_model
from django.db.models import JSONField # Import JSONField

User = get_user_model()

class StudentProfile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    education = models.CharField(max_length=255, blank=True, null=True)
    interests = JSONField(blank=True, null=True)
    aptitude_scores = JSONField(blank=True, null=True)
    skills = JSONField(blank=True, null=True)
    resume_id = models.CharField(max_length=255, blank=True, null=True)
    digilocker_id = models.CharField(max_length=255, blank=True, null=True)
    languages = JSONField(blank=True, null=True)
    consent_for_portfolio = models.BooleanField(default=False)
    career_preferences = JSONField(blank=True, null=True)

    def __str__(self):
        return f"Profile for {self.user.username}"
