import React from "react";
import { Outlet, useLocation } from "react-router-dom";
import ModuleHeader from "../../components/common/ModuleHeader";

const WarehouseManagement: React.FC = () => {
  const location = useLocation();

  // Define page mappings for breadcrumbs
  const getPageTitle = (pathname: string) => {
    if (
      pathname === "/admin/warehouse" ||
      pathname === "/admin/warehouse/" ||
      pathname === "/admin/warehouse/definitions"
    )
      return "Depo Tanımları";
    if (pathname === "/admin/warehouse/tracking") return "Lokasyon Takibi";
    if (pathname === "/admin/warehouse/putaway") return "Yerleştirme Kuralları";
    if (pathname === "/admin/warehouse/inventory") return "Stok Durumu";
    if (pathname === "/admin/warehouse/receipt") return "Stok Giriş";
    if (pathname === "/admin/warehouse/issue") return "Stok Çıkış";
    if (pathname === "/admin/warehouse/transfer") return "Stok Transfer";
    if (pathname === "/admin/warehouse/movements") return "Stok Hareketleri";
    if (pathname === "/admin/warehouse/stocklevel") return "Envanter Takibi";
    return "Depo Yönetimi";
  };

  const pageTitle = getPageTitle(location.pathname);

  // Create breadcrumbs: Anasayfa / Depo Yönetimi / Sayfanın Adı
  const breadcrumbs = [{ name: "Depo Yönetimi", href: "/admin/warehouse" }];

  return (
    <div className="min-h-screen bg-gray-50">
      <ModuleHeader title={pageTitle} breadcrumbs={breadcrumbs} />

      <div>
        <Outlet />
      </div>
    </div>
  );
};

export default WarehouseManagement;
