from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView from core.drf_mixins import JwtAuthMixin from .choices import ( RELATION_TYPES, LIFE_SPHERES, NETWORK_CIRCLES, INTERACTION_INTENSITY, choices_payload, ) class MetaChoicesView(JwtAuthMixin, APIView): def get(self, request): return Response(choices_payload()) class RelationTypesView(JwtAuthMixin, APIView): def get(self, request): return Response([{'value': v, 'label': l} for v, l in RELATION_TYPES]) class NetworkMapChoicesView(JwtAuthMixin, APIView): def get(self, request): return Response({ 'life_spheres': [{'value': v, 'label': l} for v, l in LIFE_SPHERES], 'network_circles': [{'value': v, 'label': l} for v, l in NETWORK_CIRCLES], 'interaction_intensities': [{'value': v, 'label': l} for v, l in INTERACTION_INTENSITY], })