from rest_framework.generics import ListAPIView
from api.property_api.property.models.property import Property
from api.property_api.property.serializers.property_serializer import PropertySerializer
from users.permission.sub_admin import IsCountryAdmin

class PropertyCountryListView(ListAPIView):
    serializer_class = PropertySerializer
    permission_classes = [IsCountryAdmin]

    def get_queryset(self):
        user = self.request.user
        return Property.objects.filter(country=user.country)