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

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

export type BatchExecutionResponse = {
  /**
   * Mapping of execution_id to result with status and optional error message
   */
  results?: { [k: string]: BatchExecutionResult } | undefined;
};

/** @internal */
export const BatchExecutionResponse$inboundSchema: z.ZodType<
  BatchExecutionResponse,
  unknown
> = z.object({
  results: z.record(z.string(), BatchExecutionResult$inboundSchema).optional(),
});

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