"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostV2RouterOcrResponseBody$inboundSchema = exports.PostV2RouterOcrUsage$inboundSchema = exports.Usage1$inboundSchema = exports.Usage2$inboundSchema = exports.Pages$inboundSchema = exports.Dimensions$inboundSchema = exports.Images$inboundSchema = exports.PostV2RouterOcrRequestBody$outboundSchema = exports.OcrSettings$outboundSchema = exports.Document$outboundSchema = exports.Document1$outboundSchema = exports.Document2$outboundSchema = exports.DocumentImageUrl$outboundSchema = exports.ImageUrl2$outboundSchema = void 0;
exports.imageUrl2ToJSON = imageUrl2ToJSON;
exports.documentImageUrlToJSON = documentImageUrlToJSON;
exports.document2ToJSON = document2ToJSON;
exports.document1ToJSON = document1ToJSON;
exports.documentToJSON = documentToJSON;
exports.ocrSettingsToJSON = ocrSettingsToJSON;
exports.postV2RouterOcrRequestBodyToJSON = postV2RouterOcrRequestBodyToJSON;
exports.imagesFromJSON = imagesFromJSON;
exports.dimensionsFromJSON = dimensionsFromJSON;
exports.pagesFromJSON = pagesFromJSON;
exports.usage2FromJSON = usage2FromJSON;
exports.usage1FromJSON = usage1FromJSON;
exports.postV2RouterOcrUsageFromJSON = postV2RouterOcrUsageFromJSON;
exports.postV2RouterOcrResponseBodyFromJSON = postV2RouterOcrResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
/** @internal */
exports.ImageUrl2$outboundSchema = z.object({
    url: z.string(),
    detail: z.string().optional(),
});
function imageUrl2ToJSON(imageUrl2) {
    return JSON.stringify(exports.ImageUrl2$outboundSchema.parse(imageUrl2));
}
/** @internal */
exports.DocumentImageUrl$outboundSchema = z.union([z.lazy(() => exports.ImageUrl2$outboundSchema), z.string()]);
function documentImageUrlToJSON(documentImageUrl) {
    return JSON.stringify(exports.DocumentImageUrl$outboundSchema.parse(documentImageUrl));
}
/** @internal */
exports.Document2$outboundSchema = z.object({
    type: z.literal("image_url"),
    imageUrl: z.union([z.lazy(() => exports.ImageUrl2$outboundSchema), z.string()]),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        imageUrl: "image_url",
    });
});
function document2ToJSON(document2) {
    return JSON.stringify(exports.Document2$outboundSchema.parse(document2));
}
/** @internal */
exports.Document1$outboundSchema = z.object({
    type: z.literal("document_url"),
    documentUrl: z.string(),
    documentName: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        documentUrl: "document_url",
        documentName: "document_name",
    });
});
function document1ToJSON(document1) {
    return JSON.stringify(exports.Document1$outboundSchema.parse(document1));
}
/** @internal */
exports.Document$outboundSchema = z.union([
    z.lazy(() => exports.Document1$outboundSchema),
    z.lazy(() => exports.Document2$outboundSchema),
]);
function documentToJSON(document) {
    return JSON.stringify(exports.Document$outboundSchema.parse(document));
}
/** @internal */
exports.OcrSettings$outboundSchema = z.object({
    includeImageBase64: z.nullable(z.boolean()).optional(),
    maxImagesToInclude: z.number().int().optional(),
    imageMinSize: z.number().int().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        includeImageBase64: "include_image_base64",
        maxImagesToInclude: "max_images_to_include",
        imageMinSize: "image_min_size",
    });
});
function ocrSettingsToJSON(ocrSettings) {
    return JSON.stringify(exports.OcrSettings$outboundSchema.parse(ocrSettings));
}
/** @internal */
exports.PostV2RouterOcrRequestBody$outboundSchema = z.object({
    model: z.string(),
    document: z.union([
        z.lazy(() => exports.Document1$outboundSchema),
        z.lazy(() => exports.Document2$outboundSchema),
    ]),
    pages: z.nullable(z.array(z.number().int())).optional(),
    ocrSettings: z.lazy(() => exports.OcrSettings$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        ocrSettings: "ocr_settings",
    });
});
function postV2RouterOcrRequestBodyToJSON(postV2RouterOcrRequestBody) {
    return JSON.stringify(exports.PostV2RouterOcrRequestBody$outboundSchema.parse(postV2RouterOcrRequestBody));
}
/** @internal */
exports.Images$inboundSchema = z
    .object({
    id: z.string(),
    image_base64: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "image_base64": "imageBase64",
    });
});
function imagesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Images$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Images' from JSON`);
}
/** @internal */
exports.Dimensions$inboundSchema = z.object({
    dpi: z.number().int(),
    height: z.number().int(),
    width: z.number().int(),
});
function dimensionsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Dimensions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Dimensions' from JSON`);
}
/** @internal */
exports.Pages$inboundSchema = z
    .object({
    index: z.number(),
    markdown: z.string(),
    images: z.array(z.lazy(() => exports.Images$inboundSchema)),
    dimensions: z.nullable(z.lazy(() => exports.Dimensions$inboundSchema)).optional(),
});
function pagesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Pages$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Pages' from JSON`);
}
/** @internal */
exports.Usage2$inboundSchema = z
    .object({
    type: z.literal("tokens"),
    tokens_processed: z.number().int(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "tokens_processed": "tokensProcessed",
    });
});
function usage2FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Usage2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Usage2' from JSON`);
}
/** @internal */
exports.Usage1$inboundSchema = z
    .object({
    type: z.literal("pages"),
    pages_processed: z.number().int(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "pages_processed": "pagesProcessed",
    });
});
function usage1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Usage1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Usage1' from JSON`);
}
/** @internal */
exports.PostV2RouterOcrUsage$inboundSchema = z.union([
    z.lazy(() => exports.Usage1$inboundSchema),
    z.lazy(() => exports.Usage2$inboundSchema),
]);
function postV2RouterOcrUsageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PostV2RouterOcrUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2RouterOcrUsage' from JSON`);
}
/** @internal */
exports.PostV2RouterOcrResponseBody$inboundSchema = z.object({
    model: z.string(),
    pages: z.array(z.lazy(() => exports.Pages$inboundSchema)),
    usage: z.union([
        z.lazy(() => exports.Usage1$inboundSchema),
        z.lazy(() => exports.Usage2$inboundSchema),
    ]),
});
function postV2RouterOcrResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PostV2RouterOcrResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2RouterOcrResponseBody' from JSON`);
}
//# sourceMappingURL=postv2routerocr.js.map