from django.contrib import admin
from .models import Program, SongRequest

@admin.register(Program)
class ProgramAdmin(admin.ModelAdmin):
    list_display = ('title', 'day', 'start_time', 'end_time', 'dj_name')
    list_filter = ('day',)
    search_fields = ('title', 'dj_name')

@admin.register(SongRequest)
class SongRequestAdmin(admin.ModelAdmin):
    list_display = ('song_title', 'artist_name', 'listener_name', 'created_at', 'is_played')
    list_filter = ('is_played', 'created_at')
    search_fields = ('song_title', 'artist_name', 'listener_name')
    actions = ['mark_as_played']

    def mark_as_played(self, request, queryset):
        queryset.update(is_played=True)
    mark_as_played.short_description = "Mark selected requests as played"