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

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

/**
 * Source repository information (SEP-2127).
 */
export type MCPServerRepository = {
  /**
   * Repository URL
   */
  url: string;
  /**
   * Source identifier (e.g. 'github')
   */
  source: string;
  subfolder?: string | null | undefined;
};

/** @internal */
export const MCPServerRepository$inboundSchema: z.ZodType<
  MCPServerRepository,
  unknown
> = z.object({
  url: z.string(),
  source: z.string(),
  subfolder: z.nullable(z.string()).optional(),
});

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