"""
URL configuration for backend project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.views.generic import TemplateView
from core import views as core_views

from django.conf import settings

# Customize admin headers
admin.site.site_header = f"{getattr(settings, 'APP_NAME', 'Admin')} Panel"
admin.site.site_title = f"{getattr(settings, 'APP_NAME', 'Admin')} Portal"
admin.site.index_title = f"Welcome to {getattr(settings, 'APP_NAME', 'App')} Management"

urlpatterns = [
    # Static Guest-Facing Pages
    path('', TemplateView.as_view(template_name='core/index.html'), name='home'),
    path('privacy-policy', TemplateView.as_view(template_name='core/privacy_policy.html'), name='privacy_policy'),
    path('terms-of-service', TemplateView.as_view(template_name='core/terms_of_service.html'), name='terms_of_service'),
    path('contact-us', core_views.contact_us, name='contact_us'),
    
    # API Endpoints
    path('api/push/devices', core_views.register_device, name='register_device'),
    path('api/push/send', core_views.send_custom_notification, name='send_custom_notification'),
    path('api/extract', core_views.extract_statement, name='extract_statement'),

    # Admin Panel
    path('admin/', admin.site.urls),
]

from django.conf.urls.static import static
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
