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

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";
import { Document, Document$inboundSchema } from "./document.js";
import {
  PaginationInfo,
  PaginationInfo$inboundSchema,
} from "./paginationinfo.js";

export type ListDocumentsResponse = {
  pagination: PaginationInfo;
  data: Array<Document>;
};

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

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