/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { remap as remap$ } from "../../../lib/primitives.js";
import { safeParse } from "../../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type CRMDealMatch = {
  name: string;
  /**
   * The amount in dollars.
   */
  amount: number;
  recordUrl: string;
};

/** @internal */
export const CRMDealMatch$inboundSchema: z.ZodType<
  CRMDealMatch,
  z.ZodTypeDef,
  unknown
> = z.object({
  name: z.string(),
  amount: z.number(),
  record_url: z.string(),
}).transform((v) => {
  return remap$(v, {
    "record_url": "recordUrl",
  });
});

export function crmDealMatchFromJSON(
  jsonString: string,
): SafeParseResult<CRMDealMatch, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CRMDealMatch$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CRMDealMatch' from JSON`,
  );
}
