# sales/urls.py
from django.urls import path
from . import views

app_name = 'sales'

urlpatterns = [
    path('pos/', views.pos_sales, name='pos'),
    path('pos/grid/', views.pos_grid, name='pos_grid'),
    path('receipt/<int:order_id>/', views.print_receipt, name='print_receipt'),
    path('receipt/<int:order_id>/qr/', views.generate_receipt_with_qr, name='receipt_with_qr'),
    path('repeat/<int:order_id>/', views.repeat_sale, name='repeat_sale'),
    path('reverse/<int:order_id>/', views.reverse_order, name='reverse_order'),
    path('payment-summary/', views.payment_summary, name='payment_summary'),
    path('dashboard/', views.daily_dashboard, name='daily_dashboard'),
    path('yesterday/', views.yesterday_summary, name='yesterday_summary'),
    path('sales-by-item/', views.sales_by_item_report, name='sales_by_item_report'),
    path("verify-order/", views.verify_order, name="verify_order"),

    # Transactions
    path('transactions/', views.transaction_history, name='transaction_history'),
    path('transactions/export/', views.export_transactions, name='export_transactions'),
    path('exports/orders/', views.export_all_orders, name='export_all_orders'),
    path('exports/order-items/', views.export_order_items, name='export_order_items'),
    path('exports/payments/', views.export_payments, name='export_payments'),
    path("api/orders/add/", views.api_create_order, name="api_create_order"),
    path("api/promo/validate/", views.validate_promo, name="validate_promo"),

    # Credit
    path('customers/credit/', views.credit_customers, name='credit_customers'),
    path("credit/clear/<int:order_id>/", views.clear_credit, name="clear_credit"),

    # Staff
    path('staff-performance/', views.staff_performance_dashboard, name='staff_performance'),

    # ── NEW FEATURES ────────────────────────────────────────────

    # Feature 2: P&L Report
    path('pnl/', views.pnl_report, name='pnl_report'),
    path('pnl/export/', views.export_pnl, name='export_pnl'),

    # Feature 7: Suspicious Activity
    path('suspicious/', views.suspicious_activity, name='suspicious_activity'),

    # Feature 9: Customer Management
    path('customers/', views.customer_list, name='customer_list'),
    path('customers/add/', views.customer_create, name='customer_create'),
    path('customers/<int:pk>/edit/', views.customer_edit, name='customer_edit'),
    path('customers/<int:pk>/delete/', views.customer_delete, name='customer_delete'),

    # Feature 10: Barcode POS
    path('barcode-pos/', views.barcode_pos, name='barcode_pos'),
    path('api/scan/', views.api_scan_barcode, name='api_scan_barcode'),

    # End-of-day reconciliation (#21)
    path('end-of-day/', views.end_of_day, name='end_of_day'),

    # Customer detail (#11)
    path('customers/<int:pk>/', views.customer_detail, name='customer_detail'),
]
