/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 49d94b5646c9
 */
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { smartUnion } from "../../types/smartUnion.js";
/** @internal */
export const ChatCompletionEventPreviewExtraFields$inboundSchema = smartUnion([
    z.boolean(),
    z.int(),
    z.number(),
    z.string(),
    z.iso.datetime({ offset: true }).transform(v => new Date(v)),
    z.array(z.string()),
    z.record(z.string(), z.string()),
]);
export function chatCompletionEventPreviewExtraFieldsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ChatCompletionEventPreviewExtraFields$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatCompletionEventPreviewExtraFields' from JSON`);
}
/** @internal */
export const ChatCompletionEventPreview$inboundSchema = z.object({
    event_id: z.string(),
    correlation_id: z.string(),
    created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)),
    extra_fields: z.record(z.string(), z.nullable(smartUnion([
        z.boolean(),
        z.int(),
        z.number(),
        z.string(),
        z.iso.datetime({ offset: true }).transform(v => new Date(v)),
        z.array(z.string()),
        z.record(z.string(), z.string()),
    ]))),
    nb_input_tokens: z.int(),
    nb_output_tokens: z.int(),
}).transform((v) => {
    return remap$(v, {
        "event_id": "eventId",
        "correlation_id": "correlationId",
        "created_at": "createdAt",
        "extra_fields": "extraFields",
        "nb_input_tokens": "nbInputTokens",
        "nb_output_tokens": "nbOutputTokens",
    });
});
export function chatCompletionEventPreviewFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ChatCompletionEventPreview$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatCompletionEventPreview' from JSON`);
}
//# sourceMappingURL=chatcompletioneventpreview.js.map