import { SrBoard as CwServiceTicketBoard } from "../../generated/prisma/client";
import { ServiceTicketBoard as ApiServiceTicketBoard } from "../../../api/generated/prisma/client";
import { Translation } from "./types";

export const serviceTicketBoardTranslation: Translation<
  CwServiceTicketBoard,
  ApiServiceTicketBoard
> = {
  values: [
    { from: "srBoardRecId", to: "id" },
    {
      from: "boardName",
      to: "name",
      process: (value) => (value ? value : "Unknown Board"),
    },
    {
      from: "timeBillableFlag",
      to: "timeBillableFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "expBillableFlag",
      to: "expenseBillableFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "prodBillableFlag",
      to: "productBillableFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "timeInvoiceFlag",
      to: "timeInvoiceableFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "expInvoiceFlag",
      to: "expenseInvoiceableFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "prodInvoiceFlag",
      to: "productInvoiceableFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "autoAssignNewFlag",
      to: "autoAssignNewFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "autoAssignEcFlag",
      to: "autoAssignEmailCreatedFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "autoAssignPortalFlag",
      to: "autoAssignPortalCreatedFlag",
      process: (value) => Boolean(value),
    },
    { from: "projectFlag", to: "projectFlag" },
    {
      from: "lockDescFlag",
      to: "lockDescriptionFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "emailContactFlag",
      to: "emailContactFlag",
      process: (value) => Boolean(value),
    },
    {
      from: "emailResourceFlag",
      to: "emailResourceFlag",
      process: (value) => Boolean(value),
    },
    { from: "resolutionSort", to: "resolutionSortOrder" },
    { from: "internalAnalysisSort", to: "internalAnalysisSortOrder" },
    { from: "ownerLevelRecId", to: "locationId" },
    { from: "enteredBy", to: "createdById" },
    { from: "updatedBy", to: "updatedById" },
    { from: "dateEnteredUtc", to: "createdAt" },
    { from: "lastUpdatedUtc", to: "updatedAt" },
  ],
};
