import { Member as CwMember } from "../../generated/prisma/client";
import { CwMember as ApiCwMember } from "../../../api/generated/prisma/client";
import { Translation } from "./types";

export const cwMemberTranslation: Translation<CwMember, ApiCwMember> = {
  values: [
    { from: "memberRecId", to: "cwMemberId" },
    { from: "memberId", to: "identifier" },
    {
      from: "firstName",
      to: "firstName",
      process: (value) => (value ? value : "Unknown"),
    },
    {
      from: "lastName",
      to: "lastName",
      process: (value) => (value ? value : "Member"),
    },
    { from: "emailAddress", to: "officeEmail" },
    { from: "inactiveFlag", to: "inactiveFlag" },
    {
      from: "dateHire",
      to: "createdAt",
      process: (value, _context, row) => value ?? row.lastUpdatedUtc,
    },
    { from: "lastUpdatedUtc", to: "cwLastUpdated" },
    { from: "lastUpdatedUtc", to: "updatedAt" },
  ],
};
