from rest_framework import permissions, viewsets

from boardgames.api import serializers
from boardgames import models


class BoardGameDesignerViewSet(viewsets.ModelViewSet):
    queryset = models.BoardGameDesigner.objects.all().order_by("-created")
    serializer_class = serializers.BoardGameDesignerSerializer
    permission_classes = [permissions.IsAuthenticated]


class BoardGamePublisherViewSet(viewsets.ModelViewSet):
    queryset = models.BoardGamePublisher.objects.all().order_by("-created")
    serializer_class = serializers.BoardGamePublisherSerializer
    permission_classes = [permissions.IsAuthenticated]


class BoardGameLocationViewSet(viewsets.ModelViewSet):
    queryset = models.BoardGameLocation.objects.all().order_by("-created")
    serializer_class = serializers.BoardGameLocationSerializer
    permission_classes = [permissions.IsAuthenticated]


class BoardGameViewSet(viewsets.ModelViewSet):
    queryset = models.BoardGame.objects.all().order_by("-created")
    serializer_class = serializers.BoardGameSerializer
    permission_classes = [permissions.IsAuthenticated]
