from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework import permissions
from django.urls import path


SWAGGER_SECRET_URL = 'f2552cd6-4bb2-43e2-8b0e-709c256a65ac'


schema_view = get_schema_view(
    openapi.Info(
        title="API services managment",
        default_version='mk_1.00',
        description="API list...",
    ),
    public=True,
    permission_classes=(permissions.AllowAny,),
    url="https://www.extractly.cloud/admin-docs/swagger.json",  # 👈 wymusza HTTPS
    authentication_classes=[],  # 👈 tu zostawiamy puste (tylko Swagger)
)


urlpatterns = [
    path(f'swagger/{SWAGGER_SECRET_URL}/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
    path(f'redoc/{SWAGGER_SECRET_URL}/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
    path(f'{SWAGGER_SECRET_URL}/swagger.json', schema_view.without_ui(cache_timeout=0), name='schema-json'),
]
