from rest_framework.generics import ListAPIView
from rest_framework.permissions import IsAuthenticated
from api.property_api.agent.serializer.agent_serializer import AgentSerializer
from api.property_api.agent.models.agent import Agent
from users.permission.sub_admin import IsCountryAdmin

class CountryAgentListView(ListAPIView):
    serializer_class = AgentSerializer
    # permission_classes = [IsAuthenticated]

    def get_queryset(self):
        country_id = self.kwargs.get("country_id")

        return Agent.objects.filter(
            country_id=country_id
        ).select_related("agent_user","country")
