import { Routes, Route } from "react-router-dom";
import { WarehouseProvider } from "./contexts/WarehouseContext";
import {
  WarehouseDashboard,
  ArticlesPage,
  ArticleFormPage,
  WarehouseLocationsPage,
  MovementsPage,
  InboundMovementPage,
  OutboundMovementPage,
  TransferMovementPage,
  StockLevelsPage,
} from "./pages";

export default function WarehouseRoutes() {
  return (
    <WarehouseProvider>
      <Routes>
        {/* Dashboard */}
        <Route index element={<WarehouseDashboard />} />

        {/* Articles */}
        <Route path="articles" element={<ArticlesPage />} />
        <Route path="articles/new" element={<ArticleFormPage />} />
        <Route path="articles/:id" element={<ArticleFormPage />} />
        <Route path="articles/:id/edit" element={<ArticleFormPage />} />

        {/* Warehouse Locations */}
        <Route path="locations" element={<WarehouseLocationsPage />} />

        {/* Movements */}
        <Route path="movements" element={<MovementsPage />} />
        <Route path="movements/:id" element={<MovementsPage />} />
        <Route path="movements/inbound/new" element={<InboundMovementPage />} />
        <Route
          path="movements/outbound/new"
          element={<OutboundMovementPage />}
        />
        <Route
          path="movements/transfer/new"
          element={<TransferMovementPage />}
        />

        {/* Stock */}
        <Route path="stock" element={<StockLevelsPage />} />

        {/* Fallback */}
        <Route path="*" element={<WarehouseDashboard />} />
      </Routes>
    </WarehouseProvider>
  );
}
