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

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

export const Visibility = {
  Model: "model",
  App: "app",
} as const;
export type Visibility = OpenEnum<typeof Visibility>;

/**
 * UI metadata for tools that reference UI resources.
 */
export type MCPUIToolMeta = {
  resourceUri?: string | null | undefined;
  visibility?: Array<Visibility> | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const Visibility$inboundSchema: z.ZodType<Visibility, unknown> =
  openEnums.inboundSchema(Visibility);

/** @internal */
export const MCPUIToolMeta$inboundSchema: z.ZodType<MCPUIToolMeta, unknown> = z
  .object({
    resourceUri: z.nullable(z.string()).optional(),
    visibility: z.nullable(z.array(Visibility$inboundSchema)).optional(),
  }).catchall(z.any());

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