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

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";

/**
 * Authentication requirements for a remote transport (SEP-2127).
 */
export type MCPServerAuthenticationRequirement = {
  /**
   * Whether authentication is mandatory
   */
  required: boolean;
  /**
   * Supported schemes (e.g. ['bearer', 'oauth2'])
   */
  schemes?: Array<string> | undefined;
};

/** @internal */
export const MCPServerAuthenticationRequirement$inboundSchema: z.ZodType<
  MCPServerAuthenticationRequirement,
  unknown
> = z.object({
  required: z.boolean(),
  schemes: z.array(z.string()).optional(),
});

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