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

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

/**
 * Not typed since mcp config can changed / not stable
 *
 * @remarks
 * we allow all extra fields and this is a dict
 * TODO: once mcp is stable, we need to type this
 */
export type ExecutionConfig = {
  type: string;
  additionalProperties?: { [k: string]: any } | undefined;
};

/** @internal */
export const ExecutionConfig$inboundSchema: z.ZodType<
  ExecutionConfig,
  z.ZodTypeDef,
  unknown
> = collectExtraKeys$(
  z.object({
    type: z.string(),
  }).catchall(z.any()),
  "additionalProperties",
  true,
);

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