from django.contrib import admin
from django.urls import include, path
from django.conf.urls.static import static
from projects import settings
from . import views as av

# import debug_toolbar

# handler404 = 'events.views.not_found_page'
app_name = "app"
urlpatterns = [
    # Page d'accueil dynamique
    path('', av.home, name='home'),
    
    # ========================================
    # BLOG
    # ========================================
    path('blog/', av.blog_list, name='blog_list'),
    path('blog/<slug:slug>/', av.blog_detail, name='blog_detail'),
    path('blog/categorie/<slug:slug>/', av.blog_category, name='blog_category'),
    
    # ========================================
    # RÉALISATIONS/PROJETS
    # ========================================
    path('realisations/', av.projects_list, name='projects_list'),
    path('realisations/<slug:slug>/', av.project_detail, name='project_detail'),
    path('realisations/categorie/<slug:slug>/', av.project_category, name='project_category'),
    
    # ========================================
    # À PROPOS
    # ========================================
    path('a-propos/', av.about, name='about'),
    path('packs/', av.packs, name='packs'),
    # ========================================
    # BOUTIQUE
    # ========================================
    path('boutique/', av.shop, name='shop'),
    path('boutique/produit/<slug:slug>/', av.product_detail, name='product_detail'),
    
    # ========================================
    # SIMULATION/ESTIMATION
    # ========================================
    path('simulation/', av.simulation, name='simulation'),
    
    # API Endpoints pour les simulations
    path('api/save-simulation/', av.save_simulation, name='save_simulation'),
    path('api/simulation/<int:simulation_id>/', av.get_simulation_details, name='get_simulation_details'),
    
    # API AJAX pour chargement dynamique
    path('api/load-more-posts/', av.load_more_posts, name='load_more_posts'),
    path('api/load-more-projects/', av.load_more_projects, name='load_more_projects'),
    
    # PDF Generation
    path('pdf/estimation/<int:simulation_id>/', av.generate_pdf_estimation, name='generate_pdf_estimation'),
    path('pdf/devis/<int:simulation_id>/', av.generate_pdf_quote, name='generate_pdf_quote'),
    
    # ========================================
    # PAGES D'ADMINISTRATION (BACKOFFICE)
    # ========================================
    path('admin/simulations/', av.simulation_list, name='simulation_list'),
    path('admin/simulations/<int:simulation_id>/', av.simulation_detail, name='simulation_detail'),
    path('admin/customers/', av.customer_list, name='customer_list'),
    
    # ========================================
    # DASHBOARD INTERNE
    # ========================================
    path('dashboard/', av.dashboard_home, name='dashboard_home'),
    path('dashboard/projects/', av.dashboard_projects_list, name='dashboard_projects_list'),
    path('dashboard/projects/<int:project_id>/', av.dashboard_project_detail, name='dashboard_project_detail'),
    path('dashboard/projects/<int:project_id>/finance/', av.project_finance, name='project_finance'),
    path('dashboard/activities/<int:activity_id>/', av.dashboard_activity_detail, name='dashboard_activity_detail'),
    path('dashboard/users/', av.dashboard_users_management, name='dashboard_users_management'),
    path('dashboard/profile/', av.dashboard_profile, name='dashboard_profile'),
    path('dashboard/test-notifications/', av.test_notifications, name='test_notifications'),
    
    # API AJAX pour gestion des projets
    path('api/dashboard/create-project/', av.create_dashboard_project, name='create_dashboard_project'),
    path('api/dashboard/projects/<int:project_id>/delete/', av.delete_dashboard_project, name='delete_dashboard_project'),
    path('api/dashboard/create-user/', av.create_dashboard_user, name='create_dashboard_user'),
    path('api/dashboard/clients/', av.get_clients_list, name='get_clients_list'),
    path('api/dashboard/technicians/', av.get_technicians_list, name='get_technicians_list'),
    path('api/dashboard/project-categories/', av.get_project_categories, name='get_project_categories'),
    path('dashboard/drh/list/', av.get_drh_list, name='get_drh_list'),
    path('dashboard/technicians/list/', av.get_technicians_list, name='get_technicians_list_alias'),
    
    # Nouvelles APIs pour modification et activités
    path('dashboard/projects/<int:project_id>/data/', av.get_project_data, name='get_project_data'),
    path('dashboard/projects/update/', av.update_dashboard_project, name='update_dashboard_project'),
    path('dashboard/activities/create/', av.create_dashboard_activity, name='create_dashboard_activity'),
    path('dashboard/projects/<int:project_id>/activities/', av.project_activities, name='project_activities'),
    path('dashboard/projects/<int:project_id>/activities/options/', av.get_project_activities_options, name='get_project_activities_options'),
    path('dashboard/activities/<int:activity_id>/data/', av.get_activity_data, name='get_activity_data'),
    path('dashboard/activities/<int:activity_id>/update/', av.update_dashboard_activity, name='update_dashboard_activity'),
    path('dashboard/activities/<int:activity_id>/delete/', av.delete_dashboard_activity, name='delete_dashboard_activity'),
    path('dashboard/activities/<int:activity_id>/toggle-status/', av.toggle_activity_status, name='toggle_activity_status'),
    
    # Utilitaires
    path('test/', av.test, name='test'),
    
    # PDF Generation
    path('pdf/estimation/<int:simulation_id>/', av.generate_pdf_estimation, name='generate_pdf_estimation'),
    path('pdf/devis/<int:simulation_id>/', av.generate_pdf_quote, name='generate_pdf_quote'),
]
