from django.urls import include, path
from rest_framework.routers import DefaultRouter

from . import ui_views, views

app_name = 'ai_engine'

# API router
router = DefaultRouter()
router.register(r'sentiment-results', views.SentimentResultViewSet, basename='sentiment-result')

# URL patterns
urlpatterns = [
    # API endpoints
    path('api/', include(router.urls)),
    path('api/analyze/', views.analyze_text, name='api_analyze'),
    path('api/analyze-batch/', views.analyze_batch, name='api_analyze_batch'),
    path('api/sentiment/<int:content_type_id>/<uuid:object_id>/', 
         views.get_sentiment_for_object, name='api_sentiment_for_object'),
    
    # UI endpoints
    path('', ui_views.sentiment_list, name='sentiment_list'),
    path('sentiment/<uuid:pk>/', ui_views.sentiment_detail, name='sentiment_detail'),
    path('analyze/', ui_views.analyze_text_view, name='analyze_text'),
    path('dashboard/', ui_views.sentiment_dashboard, name='sentiment_dashboard'),
    path('sentiment/<uuid:pk>/reanalyze/', ui_views.reanalyze_sentiment, name='reanalyze_sentiment'),
]
