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

import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
import { VcrRepository, VcrRepository$inboundSchema } from "./vcrrepository.js";

/**
 * A paginated list of Vercel Container Registry repositories.
 */
export type VcrRepositoryList = {
  repositories: Array<VcrRepository>;
  /**
   * Cursor to fetch the next page of results, when more are available.
   */
  nextCursor?: string | undefined;
};

/** @internal */
export const VcrRepositoryList$inboundSchema: z.ZodType<
  VcrRepositoryList,
  z.ZodTypeDef,
  unknown
> = z.object({
  repositories: z.array(VcrRepository$inboundSchema),
  nextCursor: types.optional(types.string()),
});

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