from rest_framework.response import Response
from rest_framework.views import APIView

from company.models.location import LocationCode
from company.serializers.location import LocationSerializer


class LocationCodeApi(APIView):
    """View for return location list"""

    def get(self, request, *args, **kwargs) -> Response:
        locations = LocationCode.objects.all()
        data = LocationSerializer(locations, many=True).data
        return Response(data)
