from django.urls import path, include
from rest_framework.routers import DefaultRouter
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from . import views

router = DefaultRouter()
router.register(r'responses', views.ResponseViewSet)

urlpatterns = [
    path('', include(router.urls)),

    # Survey endpoints (public)
    path('survey/config/', views.survey_config, name='survey-config'),
    path('survey/submit/', views.submit_response, name='survey-submit'),
    path('survey/partial/', views.save_partial, name='survey-partial'),

    # Auth
    path('auth/token/', TokenObtainPairView.as_view(), name='token-obtain'),
    path('auth/token/refresh/', TokenRefreshView.as_view(), name='token-refresh'),

    # Statistics (authenticated)
    path('statistics/', views.statistics, name='statistics'),
    path('statistics/<str:section>/', views.section_statistics, name='section-statistics'),
]
