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

import * as z from "zod/v4";
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 QueryWorkflowResponse = {
  queryName: string;
  /**
   * The result of the Query workflow call
   */
  result: any;
};

/** @internal */
export const QueryWorkflowResponse$inboundSchema: z.ZodType<
  QueryWorkflowResponse,
  unknown
> = z.object({
  query_name: z.string(),
  result: z.any(),
}).transform((v) => {
  return remap$(v, {
    "query_name": "queryName",
  });
});

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