from rest_framework.views import APIView
from rest_framework.response import Response
from django.contrib.auth.models import User
from playlist.serializers import UserSerializer

class UserListView(APIView):
    def get(self, request):
        users = User.objects.all()
        serializer = UserSerializer(users, many=True, context={'request': request})
        return Response(serializer.data)

class UserDetailView(APIView):
    def get(self, request, id):
        user = User.objects.get(pk=id)
        serializer = UserSerializer(user, context={'request': request})
        return Response(serializer.data)
