from django.urls import path
from . import views 

app_name = 'controle'

urlpatterns = [
    path('', views.login_view, name='login'),
    path('accounts/login/', views.login_view, name='login_alt'),  # Ajoutez ceci

     # URLs d'authentification personnalisées
    path('accounts/logout/', views.logout_view, name='logout'),
    path('accounts/profile/', views.profile_view, name='profile'),
    path('accounts/change-password/', views.change_password_view, name='change_password'),
    path('accounts/password-reset/', views.password_reset_request, name='password_reset'),

    # URLs des PVs
    path('pv/', views.liste_pv, name='liste_pv'),
    path('pv/creer/', views.creer_pv, name='creer_pv'),
    path('pv/<int:pk>/', views.detail_pv, name='detail_pv'),
    path('pv/<int:pk>/modifier/', views.modifier_pv, name='modifier_pv'),
    path('pv/<int:pk>/supprimer/', views.supprimer_pv, name='supprimer_pv'),
    path('pv/<int:pk>/imprimer/', views.imprimer_pv, name='imprimer_pv'),
    path('pv/<int:pk>/exporter_pv_pdf/', views.exporter_pv_pdf, name='exporter_pv_pdf'),
    path('pv/<int:pk>/envoyer_pv_email/', views.envoyer_pv_email, name='envoyer_pv_email'),
    path('pv/<int:pk>/finaliser_pv/', views.finaliser_pv, name='finaliser_pv'),
    path('pv/<int:pk>/visualiser/', views.visualiser_pv, name='visualiser_pv'),
    path('pv/<int:pk>/pdf/', views.generer_pdf, name='generer_pdf'),
    path('pv/<int:pk>/email/', views.envoyer_pv_email, name='envoyer_email'),
    path('pv/<int:pv_id>/signature/<int:participant_pv_id>/', views.signature_view, name='signature'),

    # URLs des photos
    path('controle/<int:controle_id>/photo/', views.ajouter_photo, name='ajouter_photo'),
    path('photo/<int:photo_id>/supprimer/', views.supprimer_photo, name='supprimer_photo'),

    # Ajoutez ces lignes dans vos urlpatterns
    path('pv/<int:pk>/export/', views.export_pv, name='export_pv'),
    path('pv/export/multiple/', views.export_pv_multiple, name='export_pv_multiple'),
    path('pv/<int:pk>/export/pdf/', views.export_pv_pdf, name='export_pv_pdf'),
    path('pv/<int:pk>/export/word/', views.exporter_pv_word, name='exporter_pv_word'),

    # API
    path('api/elements/<int:ouvrage_id>/', views.api_elements_ouvrage, name='api_elements'),

    # Parametres
    path('parametres/', views.parametres, name="parametres"),

    # Types de PV
    path('parametres/type-pv/ajouter/', views.ajouter_type_pv, name='ajouter_type_pv'),
    path('parametres/type-pv/modifier/', views.modifier_type_pv, name='modifier_type_pv'),
    path('parametres/type-pv/supprimer/', views.supprimer_type_pv, name='supprimer_type_pv'),
    path('api/type-pv/<int:type_id>/', views.get_type_pv, name='get_type_pv'),
    path('parametres/param_listepv',views.liste_type_pv, name='param_listepv'),
    path('api/rechercher-ajouter-projet/', views.rechercher_ajouter_projet, name='rechercher_ajouter_projet'),
    
    # Ouvrages
    path('parametres/ouvrage/ajouter/', views.ajouter_ouvrage, name='ajouter_ouvrage'),
    path('parametres/ouvrage/modifier/', views.modifier_ouvrage, name='modifier_ouvrage'),
    path('parametres/ouvrage/supprimer', views.supprimer_ouvrage,name='supprimer_ouvrage'),
    path('parametres/param_ouvrage',views.liste_ouvrages,name='liste_ouvrages'),
    
    # Éléments
    path('parametres/param_liste_elements', views.liste_elements, name='liste_elements'),
    path('ajouter/', views.ajouter_element, name='ajouter_element'),
    path('modifier/<int:element_id>/', views.modifier_element, name='modifier_element'),
    path('supprimer/<int:element_id>/', views.supprimer_element, name='supprimer_element'),
    path('details/<int:element_id>/', views.details_element, name='details_element'),

    # Points de contrôle
    path('parametres/param_liste_points_controle', views.liste_points_controle, name='liste_points_controle'),
    path('parametres/point_controle/ajouter/', views.ajouter_point_controle, name='ajouter_point_controle'),
    path('parametres/point_controle/modifier/<int:point_id>/', views.modifier_point_controle, name='modifier_point_controle'),
    path('parametres/point_controle/supprimer/<int:point_id>/', views.supprimer_point_controle, name='supprimer_point_controle'),
    path('parametres/point_controle/details/<int:point_id>/', views.details_point_controle, name='details_point_controle'),

    # Clients
    path('clients/', views.liste_clients, name='liste_clients'),
    path('clients/ajouter/', views.ajouter_client, name='ajouter_client'),
    path('clients/modifier/<int:client_id>/', views.modifier_client, name='modifier_client'),
    path('clients/supprimer/<int:client_id>/', views.supprimer_client, name='supprimer_client'),
    path('clients/<int:client_id>/pvs/', views.liste_pv_client, name='liste_pv_client'),
    # Projets

    # Export et utilitaires
    path('exporter/', views.exporter_elements, name='exporter_elements'),
    path('api/par-ouvrage/<int:ouvrage_id>/', views.elements_par_ouvrage, name='elements_par_ouvrage'),
] 