import { SoPipeline as CwSoPipeline } from "../../generated/prisma/client";
import { OpportunityStage as ApiOpportunityStage } from "../../../api/generated/prisma/client";
import { Translation } from "./types";

type ApiOpportunityStageRecord = {
  id: number;
  name: string;
  seqNbr?: number | null;
  funnelColor?: string | null;
  updatedById?: string | null;
  createdAt: Date;
  updatedAt: Date;
};

export const opportunityStageTranslation: Translation<
  CwSoPipeline,
  ApiOpportunityStageRecord
> = {
  values: [
    { from: "soPipelineRecId", to: "id" },
    {
      from: "description",
      to: "name",
      process: (v: string | null) => v ?? "Unknown Stage",
    },
    { from: "seqNbr", to: "seqNbr" },
    { from: "funnelColor", to: "funnelColor" },
    { from: "updatedBy", to: "updatedById" },
    { from: "dateEnteredUtc", to: "createdAt" },
    { from: "lastUpdatedUtc", to: "updatedAt" },
  ],
};
