from django.contrib import admin
from django.urls import include, path
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
from rest_framework.response import Response
from rest_framework.views import APIView

from jobs.views import HealthAPIView


class ConfigAPIView(APIView):
    def get(self, request):
        return Response(
            {
                "default_priority": 50,
                "job_types": [
                    "demo.success",
                    "demo.fail",
                    "demo.slow",
                    "demo.timeout",
                    "demo.flaky",
                ],
            }
        )


urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
    path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
    path("api/health/", HealthAPIView.as_view(), name="health"),
    path("api/config/", ConfigAPIView.as_view(), name="config"),
    path("api/", include("jobs.urls")),
]
