from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
    ChatSessionViewSet,
    ChatView,
    KnowledgeBaseViewSet,
    KnowledgeBaseStatsAPIView,
)  # Import the new viewset

# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r"sessions", ChatSessionViewSet, basename="chat-session")

# Register the new KnowledgeBaseViewSet
router.register(r"knowledge-base", KnowledgeBaseViewSet, basename="knowledge-base")


# The API URLs are now determined automatically by the router.
urlpatterns = [
    path("", include(router.urls)),
    path("chat/", ChatView.as_view(), name="chat"),
    path(
        "knowledge-base-stats/",
        KnowledgeBaseStatsAPIView.as_view(),
        name="knowledge-base-stats",
    ),
]
