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

from core.services.amc_services import AMCService


class AMCServiceStatus(APIView):

    def get(self, request, *args, **kwargs):
        service = AMCService(kwargs['service_name'])
        service_status = service.get_status()
        return Response({'status': service_status}, status=status.HTTP_200_OK)


class AMCServiceReboot(APIView):

    def get(self, request, *args, **kwargs):
        service = AMCService(kwargs['service_name'])
        service.reboot()
        return Response({'status': 'ok'}, status=status.HTTP_200_OK)
