from figurines.models import Figurine
from figurines.models import Set
from rest_framework import viewsets

from .serializers import FigurineSerializer
from .serializers import SetSerializer


class FigurineViewSet(viewsets.ModelViewSet):
    """
    API endpoints that allows figurines to be edited or viewed.

    retrieve:
    Return the given figurine

    list:
    Return a list of all existing figurines ordered by name.

    create:
    Create a new figurine instance.
    """
    queryset = Figurine.objects.all().order_by('name')
    serializer_class = FigurineSerializer


class SetViewSet(viewsets.ModelViewSet):
    """
    API endpoints that allows to edit or view sets.

    retrieve:
    Return the given set

    list:
    Return a list of all existing sets ordered by name.

    create:
    Create a new set instance.
    """
    queryset = Set.objects.all().order_by('name')
    serializer_class = SetSerializer
