from rest_framework import permissions, viewsets
from videogames.api import serializers
from videogames import models


class VideoGameViewSet(viewsets.ModelViewSet):
    queryset = models.VideoGame.objects.all().order_by("-created")
    serializer_class = serializers.VideoGameSerializer
    permission_classes = [permissions.IsAuthenticated]


class VideoGameCollectionViewSet(viewsets.ModelViewSet):
    queryset = models.VideoGameCollection.objects.all().order_by("-created")
    serializer_class = serializers.VideoGameCollectionSerializer
    permission_classes = [permissions.IsAuthenticated]


class VideoGamePlatformViewSet(viewsets.ModelViewSet):
    queryset = models.VideoGamePlatform.objects.all().order_by("-created")
    serializer_class = serializers.VideoGamePlatformSerializer
    permission_classes = [permissions.IsAuthenticated]
