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

import * as z from "zod/v4";
import {
  FunctionName,
  FunctionName$Outbound,
  FunctionName$outboundSchema,
} from "./functionname.js";

/**
 * ToolChoice is either a ToolChoiceEnum or a ToolChoice
 */
export type ToolChoice = {
  type?: string | undefined;
  /**
   * this restriction of `Function` is used to select a specific function to call
   */
  function: FunctionName;
};

/** @internal */
export type ToolChoice$Outbound = {
  type?: string | undefined;
  function: FunctionName$Outbound;
};

/** @internal */
export const ToolChoice$outboundSchema: z.ZodType<
  ToolChoice$Outbound,
  ToolChoice
> = z.object({
  type: z.string().optional(),
  function: FunctionName$outboundSchema,
});

export function toolChoiceToJSON(toolChoice: ToolChoice): string {
  return JSON.stringify(ToolChoice$outboundSchema.parse(toolChoice));
}
