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

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";
import {
  ToolConfiguration,
  ToolConfiguration$inboundSchema,
  ToolConfiguration$Outbound,
  ToolConfiguration$outboundSchema,
} from "./toolconfiguration.js";

export type WebSearchPremiumTool = {
  toolConfiguration?: ToolConfiguration | null | undefined;
  type: "web_search_premium";
};

/** @internal */
export const WebSearchPremiumTool$inboundSchema: z.ZodType<
  WebSearchPremiumTool,
  unknown
> = z.object({
  tool_configuration: z.nullable(ToolConfiguration$inboundSchema).optional(),
  type: z.literal("web_search_premium"),
}).transform((v) => {
  return remap$(v, {
    "tool_configuration": "toolConfiguration",
  });
});
/** @internal */
export type WebSearchPremiumTool$Outbound = {
  tool_configuration?: ToolConfiguration$Outbound | null | undefined;
  type: "web_search_premium";
};

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

export function webSearchPremiumToolToJSON(
  webSearchPremiumTool: WebSearchPremiumTool,
): string {
  return JSON.stringify(
    WebSearchPremiumTool$outboundSchema.parse(webSearchPremiumTool),
  );
}
export function webSearchPremiumToolFromJSON(
  jsonString: string,
): SafeParseResult<WebSearchPremiumTool, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => WebSearchPremiumTool$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'WebSearchPremiumTool' from JSON`,
  );
}
