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

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 { TurbineMeta, TurbineMeta$inboundSchema } from "./turbinemeta.js";

/**
 * Typed _meta for MCP server cards.
 *
 * @remarks
 *
 * Only the 'turbine' field is typed. Other fields are allowed via extra="allow".
 */
export type MCPServerCardMeta = {
  aiMistralTurbine?: TurbineMeta | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const MCPServerCardMeta$inboundSchema: z.ZodType<
  MCPServerCardMeta,
  unknown
> = z.object({
  "ai.mistral/turbine": z.nullable(TurbineMeta$inboundSchema).optional(),
}).catchall(z.any()).transform((v) => {
  return remap$(v, {
    "ai.mistral/turbine": "aiMistralTurbine",
  });
});

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