from django.db import models

class Problem(models.Model):
    title = models.CharField(max_length=255)
    TYPE_CHOICES = [('contest', 'Contest'), ('practice', 'Practice')]
    LEVEL_CHOICES = [('easy', 'Easy'), ('medium', 'Medium'), ('hard', 'Hard')]
    STATUS_CHOICES = [('draft', 'Draft'), ('published', 'Published')]

    type = models.CharField(max_length=10, choices=TYPE_CHOICES, default='contest')
    author = models.CharField(max_length=100)
    level = models.CharField(max_length=10, choices=LEVEL_CHOICES, default='easy')
    input_and_output_methods = models.TextField(blank=True, help_text="Describe Input and Output methods (IaOM)")
    access_code = models.CharField(max_length=50, blank=True, help_text="Optional code to access the problem")
    supported_languages = models.CharField(max_length=255, help_text="e.g., Python, C++, Java")
    description = models.TextField()
    memory_limit = models.IntegerField(help_text="Memory limit in MB")
    time_limit = models.IntegerField(help_text="Time limit in seconds")
    status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='draft')
    point = models.IntegerField(default=100)
    created_day = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title