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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type PaginationResponse = {
  nextCursor?: string | null | undefined;
  pageSize: number;
};

/** @internal */
export const PaginationResponse$inboundSchema: z.ZodType<
  PaginationResponse,
  unknown
> = z.object({
  next_cursor: z.nullable(z.string()).optional(),
  page_size: z.int(),
}).transform((v) => {
  return remap$(v, {
    "next_cursor": "nextCursor",
    "page_size": "pageSize",
  });
});

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