# backend/urls.py
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from core.views import HomeView, DashboardView
urlpatterns = [
    # Home & Dashboard
    path('', HomeView.as_view(), name='home'),
    path('dashboard/', DashboardView.as_view(), name='dashboard'),    
    # Students
    path('students/', include('students.urls')),
    # Staff
    path('staff/', include('staff.urls')),    
    # Academics
    path('academics/', include('academics.urls')),
    path('attendance/', include('academics.attendance_urls')),  # THIS LINE IS CRITICAL
    # path('attendance/', include('academics.urls_attendance')),
    # Finance
    path('finance/', include('finance.urls')),    
    # Parents
    path('parents/', include('parents.urls')),    
    # Reports
    path('reports/', include('reports.urls')),    

    # Report Cards — preview, single PDF, bulk class PDF
    path('academics/', include('academics.urls_report_cards')),

    # Communication
    path('communication/', include('communication.urls')),
    # API
    path('api/', include('api.urls')),
    # Admin
    path('admin/', admin.site.urls), ]
if settings.DEBUG:
    import os
    # Serve from the actual static source dir during development
    static_source = settings.STATICFILES_DIRS[0] if settings.STATICFILES_DIRS else settings.STATIC_ROOT
    urlpatterns += static(settings.STATIC_URL, document_root=static_source)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)