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

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 { MCPServerIcon, MCPServerIcon$inboundSchema } from "./mcpservericon.js";
import {
  PromptArgument,
  PromptArgument$inboundSchema,
} from "./promptargument.js";

export type MCPPrompt = {
  name: string;
  title?: string | null | undefined;
  description?: string | null | undefined;
  arguments?: Array<PromptArgument> | null | undefined;
  icons?: Array<MCPServerIcon> | null | undefined;
  meta?: { [k: string]: any } | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const MCPPrompt$inboundSchema: z.ZodType<MCPPrompt, unknown> = z.object({
  name: z.string(),
  title: z.nullable(z.string()).optional(),
  description: z.nullable(z.string()).optional(),
  arguments: z.nullable(z.array(PromptArgument$inboundSchema)).optional(),
  icons: z.nullable(z.array(MCPServerIcon$inboundSchema)).optional(),
  _meta: z.nullable(z.record(z.string(), z.any())).optional(),
}).catchall(z.any()).transform((v) => {
  return remap$(v, {
    "_meta": "meta",
  });
});

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