from django.db import models

class Program(models.Model):
    DAYS_OF_WEEK = [
        ('MON', 'Lunes'),
        ('TUE', 'Martes'),
        ('WED', 'Miércoles'),
        ('THU', 'Jueves'),
        ('FRI', 'Viernes'),
        ('SAT', 'Sábado'),
        ('SUN', 'Domingo'),
    ]
    title = models.CharField(max_length=200)
    description = models.TextField(blank=True)
    day = models.CharField(max_length=3, choices=DAYS_OF_WEEK)
    start_time = models.TimeField()
    end_time = models.TimeField()
    dj_name = models.CharField(max_length=100, blank=True)

    class Meta:
        ordering = ['day', 'start_time']

    def __str__(self):
        return f"{self.title} ({self.get_day_display()})"

class SongRequest(models.Model):
    listener_name = models.CharField(max_length=100)
    song_title = models.CharField(max_length=200)
    artist_name = models.CharField(max_length=200)
    message = models.TextField(blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    is_played = models.BooleanField(default=False)

    def __str__(self):
        return f"{self.song_title} by {self.artist_name} - Requested by {self.listener_name}"
