from django.views import View
from django.http import JsonResponse
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.templatetags.static import static


class VesselsDataTableURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_vessels_datatable"), safe=False)

class VesselsEditURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_vessels_edit", kwargs=kwargs), safe=False)

class VesselsDeleteURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_vessels_delete", kwargs=kwargs), safe=False)

class ReplicationSourcesDataTableURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_replication_sources_datatable"), safe=False)

class ReplicationSourcesEditURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_replication_sources_edit", kwargs=kwargs), safe=False)

class ReplicationSourcesDeleteURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_replication_sources_delete", kwargs=kwargs), safe=False)

class ReplicationTargetsDataTableURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_replication_targets_datatable"), safe=False)

class ReplicationTargetsEditURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_replication_targets_edit", kwargs=kwargs), safe=False)

class ReplicationTargetsDeleteURLView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(reverse_lazy("core:admin_replication_targets_delete", kwargs=kwargs), safe=False)

class StaticsURLView(View):
    def get(self, request, *args, **kwargs):
        return JsonResponse(static(request.GET["file"]), safe=False)