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

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 OCRUsageInfo = {
  /**
   * Number of pages processed
   */
  pagesProcessed: number;
  /**
   * Document size in bytes
   */
  docSizeBytes?: number | null | undefined;
};

/** @internal */
export const OCRUsageInfo$inboundSchema: z.ZodType<OCRUsageInfo, unknown> = z
  .object({
    pages_processed: z.int(),
    doc_size_bytes: z.nullable(z.int()).optional(),
  }).transform((v) => {
    return remap$(v, {
      "pages_processed": "pagesProcessed",
      "doc_size_bytes": "docSizeBytes",
    });
  });

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