/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 5599d0727063
 */

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

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

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

/** @internal */
export const FunctionCallEntryArguments$outboundSchema: z.ZodType<
  FunctionCallEntryArguments$Outbound,
  FunctionCallEntryArguments
> = smartUnion([z.record(z.string(), 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`,
  );
}
