/*
 * 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";

export type OCRPageDimensions = {
  /**
   * Dots per inch of the page-image
   */
  dpi: number;
  /**
   * Height of the image in pixels
   */
  height: number;
  /**
   * Width of the image in pixels
   */
  width: number;
};

/** @internal */
export const OCRPageDimensions$inboundSchema: z.ZodType<
  OCRPageDimensions,
  z.ZodTypeDef,
  unknown
> = z.object({
  dpi: z.number().int(),
  height: z.number().int(),
  width: z.number().int(),
});

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