from django.urls import path
from . import views

app_name = 'billing'

urlpatterns = [
    # Dashboard
    path('dashboard/', views.DashboardView.as_view(), name='dashboard'),
    path('taux/update/', views.update_taux_global, name='update_taux_global'),
    
    # Clients
    path('clients/', views.ClientListView.as_view(), name='client_list'),
    path('clients/create/', views.ClientCreateView.as_view(), name='client_create'),
    path('clients/<int:pk>/edit/', views.ClientUpdateView.as_view(), name='client_update'),
    path('client/<int:pk>/delete/', views.ClientDeleteView.as_view(), name='client_delete'),
    
    # DGI Actions
    path('factures/annulation-dgi/', views.annulation_facture_dgi, name='annulation_facture_dgi'),
    
    # Dossiers
    path('dossiers/', views.DossierListView.as_view(), name='dossier_list'),
    path('dossiers/create/', views.DossierCreateView.as_view(), name='dossier_create'),
    path('dossiers/<int:pk>/edit/', views.DossierUpdateView.as_view(), name='dossier_update'),
    path('dossiers/<int:pk>/', views.DossierDetailView.as_view(), name='dossier_detail'),
    
    # Proforma
    path('proformas/', views.ProformaListView.as_view(), name='proforma_list'),
    path('proformas/create/', views.ProformaCreateView.as_view(), name='proforma_create'),
    path('proformas/<int:pk>/edit/', views.ProformaUpdateView.as_view(), name='proforma_update'),
    path('proformas/<int:pk>/', views.ProformaDetailView.as_view(), name='proforma_detail'),
    path('proformas/<int:pk>/pdf/', views.proforma_pdf_view, name='proforma_pdf'),

    # Proforma Étapes (Modèle 2)
    path('proformas-etapes/', views.ProformaM2ListView.as_view(), name='proforma_m2_list'),
    path('proformas-etapes/create/', views.ProformaM2CreateView.as_view(), name='proforma_m2_create'),
    path('proformas-etapes/<int:pk>/edit/', views.ProformaM2UpdateView.as_view(), name='proforma_m2_update'),
    path('proformas-etapes/<int:pk>/', views.ProformaM2DetailView.as_view(), name='proforma_m2_detail'),
    path('proformas-etapes/<int:pk>/pdf/', views.proforma_m2_pdf_view, name='proforma_m2_pdf'),

    # Proforma Situation (Modèle 3)
    path('proformas-situation/', views.ProformaM3ListView.as_view(), name='proforma_m3_list'),
    path('proformas-situation/create/', views.ProformaM3CreateView.as_view(), name='proforma_m3_create'),
    path('proformas-situation/<int:pk>/edit/', views.ProformaM3UpdateView.as_view(), name='proforma_m3_update'),
    path('proformas-situation/<int:pk>/', views.ProformaM3DetailView.as_view(), name='proforma_m3_detail'),
    path('proformas-situation/<int:pk>/pdf/', views.proforma_m3_pdf_view, name='proforma_m3_pdf'),
    
    # Facture
    path('factures/', views.FactureListView.as_view(), name='facture_list'),
    path('factures/<int:pk>/', views.FactureDetailView.as_view(), name='facture_detail'),
    path('factures/<int:pk>/pdf/', views.facture_pdf_view, name='facture_pdf'),

    # Facture Étapes (M2)
    path('factures-etapes/', views.FactureM2ListView.as_view(), name='facture_m2_list'),
    path('factures-etapes/<int:pk>/', views.FactureM2DetailView.as_view(), name='facture_m2_detail'),
    path('factures-etapes/<int:pk>/pdf/', views.facture_m2_pdf_view, name='facture_m2_pdf'),

    # Facture Situation (M3)
    path('factures-situation/', views.FactureM3ListView.as_view(), name='facture_m3_list'),
    path('factures-situation/<int:pk>/', views.FactureM3DetailView.as_view(), name='facture_m3_detail'),
    path('factures-situation/<int:pk>/pdf/', views.facture_m3_pdf_view, name='facture_m3_pdf'),
    
    # Reports
    path('reports/', views.ReportsView.as_view(), name='reports'),
    
    # Rapports DGI (A, X, Z)
    path('rapports/a/', views.a_rapport_periode_view, name='a_rapport_periode'),
    path('rapports/a/pdf/', views.a_rapport_periode_pdf, name='a_rapport_periode_pdf'),
    
    path('rapports/x/', views.x_rapport_view, name='x_rapport'),
    path('rapports/x/pdf/', views.x_rapport_pdf, name='x_rapport_pdf'),
    
    path('rapports/z/', views.z_rapport_view, name='z_rapport'),
    path('rapports/z/pdf/', views.z_rapport_pdf, name='z_rapport_pdf'),
]
