/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { EventStream } from "../../lib/event-streams.js";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import * as components from "../components/index.js";
export const ReadServerList = [
    /**
     * Endpoint for the basin
     */
    "https://{basin}.b.aws.s2.dev/v1",
];
/** @internal */
export const ReadRequest$inboundSchema = z.object({
    stream: z.string(),
    "s2-format": components.S2Format$inboundSchema.optional(),
    seq_num: z.number().int().optional(),
    timestamp: z.number().int().optional(),
    tail_offset: z.number().int().optional(),
    count: z.number().int().optional(),
    bytes: z.number().int().optional(),
    until: z.number().int().optional(),
    clamp: z.boolean().optional(),
    "s2-basin": z.string(),
}).transform((v) => {
    return remap$(v, {
        "s2-format": "s2Format",
        "seq_num": "seqNum",
        "tail_offset": "tailOffset",
        "s2-basin": "s2Basin",
    });
});
/** @internal */
export const ReadRequest$outboundSchema = z.object({
    stream: z.string(),
    s2Format: components.S2Format$outboundSchema.optional(),
    seqNum: z.number().int().optional(),
    timestamp: z.number().int().optional(),
    tailOffset: z.number().int().optional(),
    count: z.number().int().optional(),
    bytes: z.number().int().optional(),
    until: z.number().int().optional(),
    clamp: z.boolean().optional(),
    s2Basin: z.string(),
}).transform((v) => {
    return remap$(v, {
        s2Format: "s2-format",
        seqNum: "seq_num",
        tailOffset: "tail_offset",
        s2Basin: "s2-basin",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var ReadRequest$;
(function (ReadRequest$) {
    /** @deprecated use `ReadRequest$inboundSchema` instead. */
    ReadRequest$.inboundSchema = ReadRequest$inboundSchema;
    /** @deprecated use `ReadRequest$outboundSchema` instead. */
    ReadRequest$.outboundSchema = ReadRequest$outboundSchema;
})(ReadRequest$ || (ReadRequest$ = {}));
export function readRequestToJSON(readRequest) {
    return JSON.stringify(ReadRequest$outboundSchema.parse(readRequest));
}
export function readRequestFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ReadRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReadRequest' from JSON`);
}
/** @internal */
export const ReadResponse$inboundSchema = z.union([
    components.ReadBatch$inboundSchema,
    z.instanceof((ReadableStream)).transform(stream => {
        return new EventStream(stream, rawEvent => {
            if (rawEvent.data === "[DONE]")
                return { done: true };
            return { value: components.ReadEvent$inboundSchema.parse(rawEvent) };
        });
    }),
]);
/** @internal */
export const ReadResponse$outboundSchema = z.union([components.ReadBatch$outboundSchema, z.never()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var ReadResponse$;
(function (ReadResponse$) {
    /** @deprecated use `ReadResponse$inboundSchema` instead. */
    ReadResponse$.inboundSchema = ReadResponse$inboundSchema;
    /** @deprecated use `ReadResponse$outboundSchema` instead. */
    ReadResponse$.outboundSchema = ReadResponse$outboundSchema;
})(ReadResponse$ || (ReadResponse$ = {}));
export function readResponseToJSON(readResponse) {
    return JSON.stringify(ReadResponse$outboundSchema.parse(readResponse));
}
export function readResponseFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ReadResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReadResponse' from JSON`);
}
//# sourceMappingURL=read.js.map