from rest_framework import generics, permissions
from comment.serializers import back as serializers
from comment import models
from utils.permissions import IsCommentModerator, IsCountryAdmin


class CommentLstView(generics.ListCreateAPIView):
    """Comment list create view."""
    serializer_class = serializers.CommentBaseSerializer
    queryset = models.Comment.objects.all()
    # permission_classes = [permissions.IsAuthenticatedOrReadOnly| IsCommentModerator|IsCountryAdmin]


class CommentRUDView(generics.RetrieveUpdateDestroyAPIView):
    """Comment RUD view."""
    serializer_class = serializers.CommentBaseSerializer
    queryset = models.Comment.objects.all()
    permission_classes = [IsCommentModerator]
    # permission_classes = [IsCountryAdmin | IsCommentModerator]
    lookup_field = 'id'
