# -*- coding: utf-8 -*-
"""
Core app URL configuration.

This module defines URL patterns for the core application,
including landing pages, dashboard, error pages, and API endpoints.

URL Patterns:
    - Home page and landing
    - About page
    - Contact page
    - Privacy policy page
    - Terms of service page
    - Dashboard page
    - Health check endpoint

"""

from django.urls import path, include
from django.views.generic import RedirectView
from rest_framework.routers import DefaultRouter

from apps.core.api.v1 import views


# App namespace for URL reversing
app_name = "api_core"

# Create a router and register our viewsets with it
router = DefaultRouter()
router.register(r'system-config', views.SystemConfigurationViewSet, basename='systemconfiguration')
router.register(r'metrics', views.ApplicationMetricsViewSet, basename='applicationmetrics')
router.register(r'audit-logs', views.AuditLogViewSet, basename='auditlog')
router.register(r'notification-templates', views.NotificationTemplateViewSet, basename='notificationtemplate')
router.register(r'system-health', views.SystemHealthViewSet, basename='systemhealth')

# URL patterns for core app
urlpatterns = [  

    # Legacy API endpoints
    path(
        "api/dashboard/stats/",
        views.dashboard_stats_api,
        name="dashboard_stats_api"
    ),
    
    # Enhanced dashboard stats endpoint
    path(
        "api/dashboard/enhanced-stats/",
        views.enhanced_dashboard_stats,
        name="enhanced_dashboard_stats"
    ),
    
    # Include router URLs
    path("api/", include(router.urls)),

]

# Additional URL patterns for development/testing
if hasattr(views, "DEBUG") and views.DEBUG:
    # Add debug-only URLs if needed
    pass