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

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 ToolProperties = {
  readOnly: boolean | null;
};

/** @internal */
export const ToolProperties$inboundSchema: z.ZodType<ToolProperties, unknown> =
  z.object({
    read_only: z.nullable(z.boolean()),
  }).transform((v) => {
    return remap$(v, {
      "read_only": "readOnly",
    });
  });
/** @internal */
export type ToolProperties$Outbound = {
  read_only: boolean | null;
};

/** @internal */
export const ToolProperties$outboundSchema: z.ZodType<
  ToolProperties$Outbound,
  ToolProperties
> = z.object({
  readOnly: z.nullable(z.boolean()),
}).transform((v) => {
  return remap$(v, {
    readOnly: "read_only",
  });
});

export function toolPropertiesToJSON(toolProperties: ToolProperties): string {
  return JSON.stringify(ToolProperties$outboundSchema.parse(toolProperties));
}
export function toolPropertiesFromJSON(
  jsonString: string,
): SafeParseResult<ToolProperties, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ToolProperties$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ToolProperties' from JSON`,
  );
}
