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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import {
  CodeInterpreterTool,
  CodeInterpreterTool$Outbound,
  CodeInterpreterTool$outboundSchema,
} from "./codeinterpretertool.js";
import {
  CompletionArgs,
  CompletionArgs$Outbound,
  CompletionArgs$outboundSchema,
} from "./completionargs.js";
import {
  CustomConnector,
  CustomConnector$Outbound,
  CustomConnector$outboundSchema,
} from "./customconnector.js";
import {
  DocumentLibraryTool,
  DocumentLibraryTool$Outbound,
  DocumentLibraryTool$outboundSchema,
} from "./documentlibrarytool.js";
import {
  FunctionTool,
  FunctionTool$Outbound,
  FunctionTool$outboundSchema,
} from "./functiontool.js";
import {
  GuardrailConfig,
  GuardrailConfig$Outbound,
  GuardrailConfig$outboundSchema,
} from "./guardrailconfig.js";
import {
  ImageGenerationTool,
  ImageGenerationTool$Outbound,
  ImageGenerationTool$outboundSchema,
} from "./imagegenerationtool.js";
import {
  WebSearchPremiumTool,
  WebSearchPremiumTool$Outbound,
  WebSearchPremiumTool$outboundSchema,
} from "./websearchpremiumtool.js";
import {
  WebSearchTool,
  WebSearchTool$Outbound,
  WebSearchTool$outboundSchema,
} from "./websearchtool.js";

export type UpdateAgentRequestTool =
  | CodeInterpreterTool
  | CustomConnector
  | DocumentLibraryTool
  | FunctionTool
  | ImageGenerationTool
  | WebSearchTool
  | WebSearchPremiumTool;

export type UpdateAgentRequest = {
  /**
   * Instruction prompt the model will follow during the conversation.
   */
  instructions?: string | null | undefined;
  /**
   * List of tools which are available to the model during the conversation.
   */
  tools?:
    | Array<
      | CodeInterpreterTool
      | CustomConnector
      | DocumentLibraryTool
      | FunctionTool
      | ImageGenerationTool
      | WebSearchTool
      | WebSearchPremiumTool
    >
    | undefined;
  /**
   * White-listed arguments from the completion API
   */
  completionArgs?: CompletionArgs | undefined;
  guardrails?: Array<GuardrailConfig> | null | undefined;
  model?: string | null | undefined;
  name?: string | null | undefined;
  description?: string | null | undefined;
  handoffs?: Array<string> | null | undefined;
  deploymentChat?: boolean | null | undefined;
  metadata?: { [k: string]: any } | null | undefined;
  versionMessage?: string | null | undefined;
};

/** @internal */
export type UpdateAgentRequestTool$Outbound =
  | CodeInterpreterTool$Outbound
  | CustomConnector$Outbound
  | DocumentLibraryTool$Outbound
  | FunctionTool$Outbound
  | ImageGenerationTool$Outbound
  | WebSearchTool$Outbound
  | WebSearchPremiumTool$Outbound;

/** @internal */
export const UpdateAgentRequestTool$outboundSchema: z.ZodType<
  UpdateAgentRequestTool$Outbound,
  UpdateAgentRequestTool
> = z.union([
  CodeInterpreterTool$outboundSchema,
  CustomConnector$outboundSchema,
  DocumentLibraryTool$outboundSchema,
  FunctionTool$outboundSchema,
  ImageGenerationTool$outboundSchema,
  WebSearchTool$outboundSchema,
  WebSearchPremiumTool$outboundSchema,
]);

export function updateAgentRequestToolToJSON(
  updateAgentRequestTool: UpdateAgentRequestTool,
): string {
  return JSON.stringify(
    UpdateAgentRequestTool$outboundSchema.parse(updateAgentRequestTool),
  );
}

/** @internal */
export type UpdateAgentRequest$Outbound = {
  instructions?: string | null | undefined;
  tools?:
    | Array<
      | CodeInterpreterTool$Outbound
      | CustomConnector$Outbound
      | DocumentLibraryTool$Outbound
      | FunctionTool$Outbound
      | ImageGenerationTool$Outbound
      | WebSearchTool$Outbound
      | WebSearchPremiumTool$Outbound
    >
    | undefined;
  completion_args?: CompletionArgs$Outbound | undefined;
  guardrails?: Array<GuardrailConfig$Outbound> | null | undefined;
  model?: string | null | undefined;
  name?: string | null | undefined;
  description?: string | null | undefined;
  handoffs?: Array<string> | null | undefined;
  deployment_chat?: boolean | null | undefined;
  metadata?: { [k: string]: any } | null | undefined;
  version_message?: string | null | undefined;
};

/** @internal */
export const UpdateAgentRequest$outboundSchema: z.ZodType<
  UpdateAgentRequest$Outbound,
  UpdateAgentRequest
> = z.object({
  instructions: z.nullable(z.string()).optional(),
  tools: z.array(
    z.union([
      CodeInterpreterTool$outboundSchema,
      CustomConnector$outboundSchema,
      DocumentLibraryTool$outboundSchema,
      FunctionTool$outboundSchema,
      ImageGenerationTool$outboundSchema,
      WebSearchTool$outboundSchema,
      WebSearchPremiumTool$outboundSchema,
    ]),
  ).optional(),
  completionArgs: CompletionArgs$outboundSchema.optional(),
  guardrails: z.nullable(z.array(GuardrailConfig$outboundSchema)).optional(),
  model: z.nullable(z.string()).optional(),
  name: z.nullable(z.string()).optional(),
  description: z.nullable(z.string()).optional(),
  handoffs: z.nullable(z.array(z.string())).optional(),
  deploymentChat: z.nullable(z.boolean()).optional(),
  metadata: z.nullable(z.record(z.string(), z.any())).optional(),
  versionMessage: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    completionArgs: "completion_args",
    deploymentChat: "deployment_chat",
    versionMessage: "version_message",
  });
});

export function updateAgentRequestToJSON(
  updateAgentRequest: UpdateAgentRequest,
): string {
  return JSON.stringify(
    UpdateAgentRequest$outboundSchema.parse(updateAgentRequest),
  );
}
