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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

/**
 * An argument for a prompt template.
 */
export type PromptArgument = {
  name: string;
  description?: string | null | undefined;
  required?: boolean | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const PromptArgument$inboundSchema: z.ZodType<PromptArgument, unknown> =
  z.object({
    name: z.string(),
    description: z.nullable(z.string()).optional(),
    required: z.nullable(z.boolean()).optional(),
  }).catchall(z.any());

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