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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import {
  ToolConfiguration,
  ToolConfiguration$Outbound,
  ToolConfiguration$outboundSchema,
} from "./toolconfiguration.js";

export type WebSearchTool = {
  toolConfiguration?: ToolConfiguration | null | undefined;
  type: "web_search";
};

/** @internal */
export type WebSearchTool$Outbound = {
  tool_configuration?: ToolConfiguration$Outbound | null | undefined;
  type: "web_search";
};

/** @internal */
export const WebSearchTool$outboundSchema: z.ZodType<
  WebSearchTool$Outbound,
  WebSearchTool
> = z.object({
  toolConfiguration: z.nullable(ToolConfiguration$outboundSchema).optional(),
  type: z.literal("web_search"),
}).transform((v) => {
  return remap$(v, {
    toolConfiguration: "tool_configuration",
  });
});

export function webSearchToolToJSON(webSearchTool: WebSearchTool): string {
  return JSON.stringify(WebSearchTool$outboundSchema.parse(webSearchTool));
}
