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

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";

export type ToolConfiguration = {
  exclude?: Array<string> | null | undefined;
  include?: Array<string> | null | undefined;
  requiresConfirmation?: Array<string> | null | undefined;
};

/** @internal */
export const ToolConfiguration$inboundSchema: z.ZodType<
  ToolConfiguration,
  unknown
> = z.object({
  exclude: z.nullable(z.array(z.string())).optional(),
  include: z.nullable(z.array(z.string())).optional(),
  requires_confirmation: z.nullable(z.array(z.string())).optional(),
}).transform((v) => {
  return remap$(v, {
    "requires_confirmation": "requiresConfirmation",
  });
});
/** @internal */
export type ToolConfiguration$Outbound = {
  exclude?: Array<string> | null | undefined;
  include?: Array<string> | null | undefined;
  requires_confirmation?: Array<string> | null | undefined;
};

/** @internal */
export const ToolConfiguration$outboundSchema: z.ZodType<
  ToolConfiguration$Outbound,
  ToolConfiguration
> = z.object({
  exclude: z.nullable(z.array(z.string())).optional(),
  include: z.nullable(z.array(z.string())).optional(),
  requiresConfirmation: z.nullable(z.array(z.string())).optional(),
}).transform((v) => {
  return remap$(v, {
    requiresConfirmation: "requires_confirmation",
  });
});

export function toolConfigurationToJSON(
  toolConfiguration: ToolConfiguration,
): string {
  return JSON.stringify(
    ToolConfiguration$outboundSchema.parse(toolConfiguration),
  );
}
export function toolConfigurationFromJSON(
  jsonString: string,
): SafeParseResult<ToolConfiguration, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ToolConfiguration$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ToolConfiguration' from JSON`,
  );
}
