/*
 * 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 {
  VcrImageListItem,
  VcrImageListItem$inboundSchema,
} from "./vcrimagelistitem.js";

/**
 * A paginated list of images for a repository.
 */
export type VcrImageList = {
  images: Array<VcrImageListItem>;
  /**
   * Cursor to fetch the next page of results, when more are available.
   */
  nextCursor?: string | undefined;
};

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

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