/*
 * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { DocumentOut, DocumentOut$inboundSchema } from "./documentout.js";
import {
  PaginationInfo,
  PaginationInfo$inboundSchema,
} from "./paginationinfo.js";

export type ListDocumentOut = {
  pagination: PaginationInfo;
  data: Array<DocumentOut>;
};

/** @internal */
export const ListDocumentOut$inboundSchema: z.ZodType<
  ListDocumentOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  pagination: PaginationInfo$inboundSchema,
  data: z.array(DocumentOut$inboundSchema),
});

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