// One typed client method for reference data (docs/11-BACKEND-PHASE1.md §6).
// In-memory sample data (lib/api/mock-data.ts) — no backend API calls.
import { PagedResponse } from "@/types/common"
import { ReasonCode, ReasonCodeContext } from "@/types/stock"
import { mockDelay, mockReasonCodes } from "@/lib/api/mock-data"

export const reasonCodesApi = {
  list(context?: ReasonCodeContext): Promise<PagedResponse<ReasonCode>> {
    const items = mockReasonCodes.filter((r) => !context || r.context === context)
    return mockDelay({
      items,
      pagination: { page: 1, pageSize: 20, totalItems: items.length, totalPages: 1 },
    })
  },
}
