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

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 PaginationInfo = {
  totalItems: number;
  totalPages: number;
  currentPage: number;
  pageSize: number;
  hasMore: boolean;
};

/** @internal */
export const PaginationInfo$inboundSchema: z.ZodType<PaginationInfo, unknown> =
  z.object({
    total_items: z.int(),
    total_pages: z.int(),
    current_page: z.int(),
    page_size: z.int(),
    has_more: z.boolean(),
  }).transform((v) => {
    return remap$(v, {
      "total_items": "totalItems",
      "total_pages": "totalPages",
      "current_page": "currentPage",
      "page_size": "pageSize",
      "has_more": "hasMore",
    });
  });

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