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

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

export type FunctionCallEntryArguments = { [k: string]: any } | string;

/** @internal */
export const FunctionCallEntryArguments$inboundSchema: z.ZodType<
  FunctionCallEntryArguments,
  z.ZodTypeDef,
  unknown
> = z.union([z.record(z.any()), z.string()]);
/** @internal */
export type FunctionCallEntryArguments$Outbound = { [k: string]: any } | string;

/** @internal */
export const FunctionCallEntryArguments$outboundSchema: z.ZodType<
  FunctionCallEntryArguments$Outbound,
  z.ZodTypeDef,
  FunctionCallEntryArguments
> = z.union([z.record(z.any()), z.string()]);

export function functionCallEntryArgumentsToJSON(
  functionCallEntryArguments: FunctionCallEntryArguments,
): string {
  return JSON.stringify(
    FunctionCallEntryArguments$outboundSchema.parse(functionCallEntryArguments),
  );
}
export function functionCallEntryArgumentsFromJSON(
  jsonString: string,
): SafeParseResult<FunctionCallEntryArguments, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => FunctionCallEntryArguments$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'FunctionCallEntryArguments' from JSON`,
  );
}
