from django.urls import path
from . import views
from .views import ReportCRUDView, CustomerTemplateCRUDView, ProductDrawingCRUDView, MksCodeMapCRUDView

report_crud = ReportCRUDView()
customer_templates_crud = CustomerTemplateCRUDView()
product_drawings_crud = ProductDrawingCRUDView()
code_maps_crud = MksCodeMapCRUDView()

app_name = "report"  # Use this namespace for reverse URL lookups

urlpatterns = [
    # path('reports/', views.index, name='report_index'),  # Homepage for the report app
    # path('reports/create/', views.report_create_view, name='report_create'),
    path('report/', report_crud.get_list_view().as_view(), name='report-list'),
    path('report/create/', report_crud.get_create_view().as_view(), name='report-create'),
    path('report/<int:pk>/update/', report_crud.get_update_view().as_view(), name='report-update'),
    path('report/<int:pk>/delete/', report_crud.get_delete_view().as_view(), name='report-delete'),
    path('coi/', views.coi_view, name='coi-view'),
    path('report/generate/', views.gen_report_view, name='gen_report'),

    path('customer_templates/', customer_templates_crud.get_list_view().as_view(), name='customer_templates-list'),
    path('customer_templates/create/', customer_templates_crud.get_create_view().as_view(), name='customer_templates-create'),
    path('customer_templates/<str:pk>/update/', customer_templates_crud.get_update_view().as_view(), name='customer_templates-update'),
    path('customer_templates/<str:pk>/delete/', customer_templates_crud.get_delete_view().as_view(), name='customer_templates-delete'),
    
    path('product_drawings/', product_drawings_crud.get_list_view().as_view(), name='product_drawings-list'),
    path('product_drawings/create/', product_drawings_crud.get_create_view().as_view(), name='product_drawings-create'),
    path('product_drawings/<str:pk>/update/', product_drawings_crud.get_update_view().as_view(), name='product_drawings-update'),
    path('product_drawings/<str:pk>/delete/', product_drawings_crud.get_delete_view().as_view(), name='product_drawings-delete'),
    
    path('code_maps/', code_maps_crud.get_list_view().as_view(), name='code_maps-list'),
    path('code_maps/create/', code_maps_crud.get_create_view().as_view(), name='code_maps-create'),
    path('code_maps/<str:pk>/update/', code_maps_crud.get_update_view().as_view(), name='code_maps-update'),
    path('code_maps/<str:pk>/delete/', code_maps_crud.get_delete_view().as_view(), name='code_maps-delete'),
    # path('create/', views.create_report, name='create'),  # Create a new report
    # path('<int:pk>/', views.detail_report, name='detail'),  # View details of a specific report
    # path('<int:pk>/update/', views.update_report, name='update'),  # Update a specific report
    # path('<int:pk>/delete/', views.delete_report, name='delete'),  # Delete a specific report
    # path('generate/', views.generate_excel_report, name='generate_excel'),  # Custom route for Excel generation
]
