import { kbxApi } from '../../../http/generated/kbxApiClient'
import type { InventoryHistoryRow, InventoryItemRow, InventoryLocationRow } from './inventory.definition'
export interface InventorySearchResponse { items: InventoryItemRow[]; totalCount: number }
export const inventoryApi = {
  search(keyword = '') { return kbxApi.request<InventorySearchResponse>('erp.inventory.search', { query: { keyword, page: 1, pageSize: 200 } }) },
  locations(itemId: string) { return kbxApi.request<{ items: InventoryLocationRow[] }>('erp.inventory.locations', { path: { itemId } }) },
  history(itemId: string) { return kbxApi.request<{ items: InventoryHistoryRow[] }>('erp.inventory.history', { path: { itemId }, query:{ pageSize:100 } }) },
}
