from rest_framework import permissions, viewsets

from videos.api.serializers import (
    ChannelSerializer,
    SeriesSerializer,
    VideoSerializer,
)
from videos.models import Channel, Series, Video


class ChannelViewSet(viewsets.ModelViewSet):
    queryset = Channel.objects.all().order_by("-created")
    serializer_class = ChannelSerializer
    permission_classes = [permissions.IsAuthenticated]


class SeriesViewSet(viewsets.ModelViewSet):
    queryset = Series.objects.all().order_by("-created")
    serializer_class = SeriesSerializer
    permission_classes = [permissions.IsAuthenticated]


class VideoViewSet(viewsets.ModelViewSet):
    queryset = Video.objects.all().order_by("-created")
    serializer_class = VideoSerializer
    permission_classes = [permissions.IsAuthenticated]
