from rest_framework.views import APIView
from rest_framework.response import Response
from playlist.models import Album
from playlist.serializers import AlbumSerializer

class AlbumListView(APIView):
    def get(self, request):
        albums = Album.objects.all()
        serializer = AlbumSerializer(albums, many=True, context={'request': request})
        return Response(serializer.data)

class AlbumDetailView(APIView):
    def get(self, request, id):
        album = Album.objects.get(pk=id)
        serializer = AlbumSerializer(album, context={'request': request})
        return Response(serializer.data)
