"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.ReadResponse$ = exports.ReadResponse$outboundSchema = exports.ReadResponse$inboundSchema = exports.ReadRequest$ = exports.ReadRequest$outboundSchema = exports.ReadRequest$inboundSchema = exports.ReadServerList = void 0;
exports.readRequestToJSON = readRequestToJSON;
exports.readRequestFromJSON = readRequestFromJSON;
exports.readResponseToJSON = readResponseToJSON;
exports.readResponseFromJSON = readResponseFromJSON;
const z = __importStar(require("zod"));
const event_streams_js_1 = require("../../lib/event-streams.js");
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const components = __importStar(require("../components/index.js"));
exports.ReadServerList = [
    /**
     * Endpoint for the basin
     */
    "https://{basin}.b.aws.s2.dev/v1",
];
/** @internal */
exports.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 (0, primitives_js_1.remap)(v, {
        "s2-format": "s2Format",
        "seq_num": "seqNum",
        "tail_offset": "tailOffset",
        "s2-basin": "s2Basin",
    });
});
/** @internal */
exports.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 (0, primitives_js_1.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.
 */
var ReadRequest$;
(function (ReadRequest$) {
    /** @deprecated use `ReadRequest$inboundSchema` instead. */
    ReadRequest$.inboundSchema = exports.ReadRequest$inboundSchema;
    /** @deprecated use `ReadRequest$outboundSchema` instead. */
    ReadRequest$.outboundSchema = exports.ReadRequest$outboundSchema;
})(ReadRequest$ || (exports.ReadRequest$ = ReadRequest$ = {}));
function readRequestToJSON(readRequest) {
    return JSON.stringify(exports.ReadRequest$outboundSchema.parse(readRequest));
}
function readRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ReadRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReadRequest' from JSON`);
}
/** @internal */
exports.ReadResponse$inboundSchema = z.union([
    components.ReadBatch$inboundSchema,
    z.instanceof((ReadableStream)).transform(stream => {
        return new event_streams_js_1.EventStream(stream, rawEvent => {
            if (rawEvent.data === "[DONE]")
                return { done: true };
            return { value: components.ReadEvent$inboundSchema.parse(rawEvent) };
        });
    }),
]);
/** @internal */
exports.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.
 */
var ReadResponse$;
(function (ReadResponse$) {
    /** @deprecated use `ReadResponse$inboundSchema` instead. */
    ReadResponse$.inboundSchema = exports.ReadResponse$inboundSchema;
    /** @deprecated use `ReadResponse$outboundSchema` instead. */
    ReadResponse$.outboundSchema = exports.ReadResponse$outboundSchema;
})(ReadResponse$ || (exports.ReadResponse$ = ReadResponse$ = {}));
function readResponseToJSON(readResponse) {
    return JSON.stringify(exports.ReadResponse$outboundSchema.parse(readResponse));
}
function readResponseFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ReadResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReadResponse' from JSON`);
}
//# sourceMappingURL=read.js.map