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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import * as openEnums from "../../types/enums.js";
import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export const TaskSupport = {
  Forbidden: "forbidden",
  Optional: "optional",
  Required: "required",
} as const;
export type TaskSupport = OpenEnum<typeof TaskSupport>;

/**
 * Execution-related properties for a tool.
 */
export type ToolExecution = {
  taskSupport?: TaskSupport | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const TaskSupport$inboundSchema: z.ZodType<TaskSupport, unknown> =
  openEnums.inboundSchema(TaskSupport);

/** @internal */
export const ToolExecution$inboundSchema: z.ZodType<ToolExecution, unknown> = z
  .object({
    taskSupport: z.nullable(TaskSupport$inboundSchema).optional(),
  }).catchall(z.any());

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