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

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 DocumentLibraryTool = {
  toolConfiguration?: ToolConfiguration | null | undefined;
  type: "document_library";
  /**
   * Ids of the library in which to search.
   */
  libraryIds: Array<string>;
};

/** @internal */
export type DocumentLibraryTool$Outbound = {
  tool_configuration?: ToolConfiguration$Outbound | null | undefined;
  type: "document_library";
  library_ids: Array<string>;
};

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

export function documentLibraryToolToJSON(
  documentLibraryTool: DocumentLibraryTool,
): string {
  return JSON.stringify(
    DocumentLibraryTool$outboundSchema.parse(documentLibraryTool),
  );
}
