"""
URL configuration for Social Media app
"""
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from .views import SocialMediaCommentViewSet
from . import ui_views

app_name = 'social'

# API Router
router = DefaultRouter()
router.register(r'api/comments', SocialMediaCommentViewSet, basename='social-comment-api')

urlpatterns = [
    # UI Views - Specific paths first
    path('', ui_views.social_comment_list, name='social_comment_list'),
    path('analytics/', ui_views.social_analytics, name='social_analytics'),
    path('scrape/', ui_views.social_scrape_now, name='social_scrape_now'),
    
    # Export Views - Must come before catch-all patterns
    path('export/csv/', ui_views.social_export_csv, name='social_export_csv'),
    path('export/excel/', ui_views.social_export_excel, name='social_export_excel'),
    
    # Platform-specific view
    path('<str:platform>/', ui_views.social_platform, name='social_platform'),
    
    # Comment detail view - Must be LAST to avoid conflicts
    path('comment/<int:pk>/', ui_views.social_comment_detail, name='social_comment_detail'),
    
    # API Routes
    path('', include(router.urls)),
]
