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


class ExerciseViewSet(viewsets.ModelViewSet):
    queryset = models.Exercise.objects.all().order_by("name")
    serializer_class = serializers.ExerciseSerializer
    permission_classes = [permissions.IsAuthenticated]


class WorkoutRoutineViewSet(viewsets.ModelViewSet):
    queryset = models.WorkoutRoutine.objects.all().order_by("-created")
    serializer_class = serializers.WorkoutRoutineSerializer
    permission_classes = [permissions.IsAuthenticated]


class WorkoutImportViewSet(viewsets.ModelViewSet):
    queryset = models.WorkoutImport.objects.all().order_by("-created")
    serializer_class = serializers.WorkoutImportSerializer
    permission_classes = [permissions.IsAuthenticated]
