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

import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";

export type BatchRequest = {
  customId?: string | null | undefined;
  body: { [k: string]: any };
};

/** @internal */
export type BatchRequest$Outbound = {
  custom_id?: string | null | undefined;
  body: { [k: string]: any };
};

/** @internal */
export const BatchRequest$outboundSchema: z.ZodType<
  BatchRequest$Outbound,
  z.ZodTypeDef,
  BatchRequest
> = z.object({
  customId: z.nullable(z.string()).optional(),
  body: z.record(z.any()),
}).transform((v) => {
  return remap$(v, {
    customId: "custom_id",
  });
});

export function batchRequestToJSON(batchRequest: BatchRequest): string {
  return JSON.stringify(BatchRequest$outboundSchema.parse(batchRequest));
}
