from rest_framework import permissions, viewsets

from webpages.api.serializers import (
    DomainSerializer,
    WebPageSerializer,
)
from webpages.models import Domain, WebPage


class DomainViewSet(viewsets.ModelViewSet):
    queryset = Domain.objects.all().order_by("-created")
    serializer_class = DomainSerializer
    permission_classes = [permissions.IsAuthenticated]


class WebPageViewSet(viewsets.ModelViewSet):
    queryset = WebPage.objects.all().order_by("-created")
    serializer_class = WebPageSerializer
    permission_classes = [permissions.IsAuthenticated]
