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

# Create a router for ViewSets (if we add any later)
router = DefaultRouter()

app_name = 'services_api'

urlpatterns = [
    # Service URLs
    path('', views.ServiceListView.as_view(), name='service-list'),
    path('featured/', views.FeaturedServicesView.as_view(), name='featured-services'),
    path('search/', views.service_search, name='service-search'),
    path('stats/', views.service_stats, name='service-stats'),
    path('<slug:slug>/', views.ServiceDetailView.as_view(), name='service-detail'),
    
    # Admin URLs (require authentication)
    path('admin/create/', views.ServiceCreateView.as_view(), name='service-create'),
    path('admin/<slug:slug>/update/', views.ServiceUpdateView.as_view(), name='service-update'),
    path('admin/<slug:slug>/delete/', views.ServiceDeleteView.as_view(), name='service-delete'),
    path('admin/<slug:slug>/upload-image/', views.upload_service_image, name='service-upload-image'),
    
    # Category URLs
    path('categories/', views.ServiceCategoryListView.as_view(), name='category-list'),
    path('categories/<slug:slug>/', views.ServiceCategoryDetailView.as_view(), name='category-detail'),
    
    # Include router URLs
    path('', include(router.urls)),
]
