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


class BeerViewSet(viewsets.ModelViewSet):
    queryset = models.Beer.objects.all().order_by("-created")
    serializer_class = serializers.BeerSerializer
    permission_classes = [permissions.IsAuthenticated]

class BeerProducerViewSet(viewsets.ModelViewSet):
    queryset = models.BeerProducer.objects.all().order_by("-created")
    serializer_class = serializers.BeerProducerSerializer
    permission_classes = [permissions.IsAuthenticated]

class BeerStyleViewSet(viewsets.ModelViewSet):
    queryset = models.BeerStyle.objects.all().order_by("-created")
    serializer_class = serializers.BeerStyleSerializer
    permission_classes = [permissions.IsAuthenticated]
