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

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";

/**
 * Response model for synchronous workflow execution
 */
export type WorkflowExecutionSyncResponse = {
  /**
   * Name of the workflow that was executed
   */
  workflowName: string;
  /**
   * ID of the workflow execution
   */
  executionId: string;
  /**
   * The result of the workflow execution
   */
  result: any;
};

/** @internal */
export const WorkflowExecutionSyncResponse$inboundSchema: z.ZodType<
  WorkflowExecutionSyncResponse,
  unknown
> = z.object({
  workflow_name: z.string(),
  execution_id: z.string(),
  result: z.any(),
}).transform((v) => {
  return remap$(v, {
    "workflow_name": "workflowName",
    "execution_id": "executionId",
  });
});

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