import { WarehouseBin as CwWarehouseBin } from "../../generated/prisma/client";
import { WarehouseBin as ApiWarehouseBin } from "../../../api/generated/prisma/client";
import { Translation } from "./types";

export const warehouseBinTranslation: Translation<
  CwWarehouseBin,
  ApiWarehouseBin
> = {
  values: [
    { from: "warehouseBinRecId", to: "id" },
    {
      from: "description",
      to: "name",
      process: (value) => (value ? value : "Unlabeled Bin"),
    },
    { from: "description", to: "description" },
    {
      from: "minQuantity",
      to: "minQuantity",
      process: (value) => (value == null ? 0 : Number(value)),
    },
    {
      from: "maxQuantity",
      to: "maxQuantity",
      process: (value) => (value == null ? 0 : Number(value)),
    },
    {
      from: "inactiveFlag",
      to: "inactiveFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "defaultFlag",
      to: "defaultFlag",
      process: (value) => Boolean(value),
    },
    { from: "warehouseRecId", to: "warehouseId" },
    { from: "updatedBy", to: "updatedById" },
    { from: "enteredBy", to: "createdById" },
    { from: "lastUpdatedUtc", to: "updatedAt" },
    { from: "dateEnteredUtc", to: "createdAt" },
  ],
};
