/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { SequencedRecord$inboundSchema, SequencedRecord$outboundSchema, } from "./sequencedrecord.js";
import { StreamPosition$inboundSchema, StreamPosition$outboundSchema, } from "./streamposition.js";
/** @internal */
export const ReadBatch$inboundSchema = z.object({
    records: z.array(SequencedRecord$inboundSchema),
    tail: z.nullable(StreamPosition$inboundSchema).optional(),
});
/** @internal */
export const ReadBatch$outboundSchema = z.object({
    records: z.array(SequencedRecord$outboundSchema),
    tail: z.nullable(StreamPosition$outboundSchema).optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var ReadBatch$;
(function (ReadBatch$) {
    /** @deprecated use `ReadBatch$inboundSchema` instead. */
    ReadBatch$.inboundSchema = ReadBatch$inboundSchema;
    /** @deprecated use `ReadBatch$outboundSchema` instead. */
    ReadBatch$.outboundSchema = ReadBatch$outboundSchema;
})(ReadBatch$ || (ReadBatch$ = {}));
export function readBatchToJSON(readBatch) {
    return JSON.stringify(ReadBatch$outboundSchema.parse(readBatch));
}
export function readBatchFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ReadBatch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReadBatch' from JSON`);
}
//# sourceMappingURL=readbatch.js.map