"use client";

import React from "react";
import DiscrepanciesPage from "@/components/discrepancies/DiscrepanciesPage";
import { useAuth } from "@/contexts/AuthContext";

export default function PalletDiscrepanciesPage() {
  const { isAdmin } = useAuth();

  // Shipment/PO detail pages are still role-specific — pick the right path
  // builder based on the current user's role.
  const shipmentLinkPath = isAdmin()
    ? (id: number) => `/warehouses/shipments/${id}`
    : (id: number) => `/manufacturer/shipments/${id}`;
  const purchaseOrderLinkPath = isAdmin()
    ? (id: number) => `/purchase-orders/${id}`
    : (id: number) => `/manufacturer/manage-orders/${id}`;

  return (
    <DiscrepanciesPage
      shipmentLinkPath={shipmentLinkPath}
      purchaseOrderLinkPath={purchaseOrderLinkPath}
      itemDiscrepanciesPath="/discrepancies/items"
    />
  );
}
