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

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 { ToolType, ToolType$inboundSchema } from "./tooltype.js";
import {
  TurbineToolLocale,
  TurbineToolLocale$inboundSchema,
} from "./turbinetoollocale.js";

export type TurbineToolMeta = {
  locale?: TurbineToolLocale | null | undefined;
  toolType?: ToolType | null | undefined;
  timeout?: number | null | undefined;
  privateExecution?: boolean | null | undefined;
};

/** @internal */
export const TurbineToolMeta$inboundSchema: z.ZodType<
  TurbineToolMeta,
  unknown
> = z.object({
  locale: z.nullable(TurbineToolLocale$inboundSchema).optional(),
  tool_type: z.nullable(ToolType$inboundSchema).optional(),
  timeout: z.nullable(z.number()).optional(),
  private_execution: z.nullable(z.boolean()).optional(),
}).transform((v) => {
  return remap$(v, {
    "tool_type": "toolType",
    "private_execution": "privateExecution",
  });
});

export function turbineToolMetaFromJSON(
  jsonString: string,
): SafeParseResult<TurbineToolMeta, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => TurbineToolMeta$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'TurbineToolMeta' from JSON`,
  );
}
