"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.ReadEvent$ = exports.ReadEvent$outboundSchema = exports.ReadEvent$inboundSchema = exports.Batch$ = exports.Batch$outboundSchema = exports.Batch$inboundSchema = exports.Event$ = exports.Event$outboundSchema = exports.Event$inboundSchema = exports.ErrorT$ = exports.ErrorT$outboundSchema = exports.ErrorT$inboundSchema = exports.ReadEventEvent$ = exports.ReadEventEvent$outboundSchema = exports.ReadEventEvent$inboundSchema = exports.Ping$ = exports.Ping$outboundSchema = exports.Ping$inboundSchema = exports.ReadEvent3Event$ = exports.ReadEvent3Event$outboundSchema = exports.ReadEvent3Event$inboundSchema = exports.Event = exports.ReadEventEvent = exports.ReadEvent3Event = void 0;
exports.pingToJSON = pingToJSON;
exports.pingFromJSON = pingFromJSON;
exports.errorToJSON = errorToJSON;
exports.errorFromJSON = errorFromJSON;
exports.batchToJSON = batchToJSON;
exports.batchFromJSON = batchFromJSON;
exports.readEventToJSON = readEventToJSON;
exports.readEventFromJSON = readEventFromJSON;
const z = __importStar(require("zod"));
const schemas_js_1 = require("../../lib/schemas.js");
const pingeventdata_js_1 = require("./pingeventdata.js");
const readbatch_js_1 = require("./readbatch.js");
exports.ReadEvent3Event = {
    Ping: "ping",
};
exports.ReadEventEvent = {
    Error: "error",
};
exports.Event = {
    Batch: "batch",
};
/** @internal */
exports.ReadEvent3Event$inboundSchema = z.nativeEnum(exports.ReadEvent3Event);
/** @internal */
exports.ReadEvent3Event$outboundSchema = exports.ReadEvent3Event$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var ReadEvent3Event$;
(function (ReadEvent3Event$) {
    /** @deprecated use `ReadEvent3Event$inboundSchema` instead. */
    ReadEvent3Event$.inboundSchema = exports.ReadEvent3Event$inboundSchema;
    /** @deprecated use `ReadEvent3Event$outboundSchema` instead. */
    ReadEvent3Event$.outboundSchema = exports.ReadEvent3Event$outboundSchema;
})(ReadEvent3Event$ || (exports.ReadEvent3Event$ = ReadEvent3Event$ = {}));
/** @internal */
exports.Ping$inboundSchema = z
    .object({
    data: z.string().transform((v, ctx) => {
        try {
            return JSON.parse(v);
        }
        catch (err) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: `malformed json: ${err}`,
            });
            return z.NEVER;
        }
    }).pipe(pingeventdata_js_1.PingEventData$inboundSchema),
    event: exports.ReadEvent3Event$inboundSchema,
});
/** @internal */
exports.Ping$outboundSchema = z.object({
    data: pingeventdata_js_1.PingEventData$outboundSchema,
    event: exports.ReadEvent3Event$outboundSchema,
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Ping$;
(function (Ping$) {
    /** @deprecated use `Ping$inboundSchema` instead. */
    Ping$.inboundSchema = exports.Ping$inboundSchema;
    /** @deprecated use `Ping$outboundSchema` instead. */
    Ping$.outboundSchema = exports.Ping$outboundSchema;
})(Ping$ || (exports.Ping$ = Ping$ = {}));
function pingToJSON(ping) {
    return JSON.stringify(exports.Ping$outboundSchema.parse(ping));
}
function pingFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Ping$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Ping' from JSON`);
}
/** @internal */
exports.ReadEventEvent$inboundSchema = z.nativeEnum(exports.ReadEventEvent);
/** @internal */
exports.ReadEventEvent$outboundSchema = exports.ReadEventEvent$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var ReadEventEvent$;
(function (ReadEventEvent$) {
    /** @deprecated use `ReadEventEvent$inboundSchema` instead. */
    ReadEventEvent$.inboundSchema = exports.ReadEventEvent$inboundSchema;
    /** @deprecated use `ReadEventEvent$outboundSchema` instead. */
    ReadEventEvent$.outboundSchema = exports.ReadEventEvent$outboundSchema;
})(ReadEventEvent$ || (exports.ReadEventEvent$ = ReadEventEvent$ = {}));
/** @internal */
exports.ErrorT$inboundSchema = z
    .object({
    data: z.string(),
    event: exports.ReadEventEvent$inboundSchema,
});
/** @internal */
exports.ErrorT$outboundSchema = z.object({
    data: z.string(),
    event: exports.ReadEventEvent$outboundSchema,
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var ErrorT$;
(function (ErrorT$) {
    /** @deprecated use `ErrorT$inboundSchema` instead. */
    ErrorT$.inboundSchema = exports.ErrorT$inboundSchema;
    /** @deprecated use `ErrorT$outboundSchema` instead. */
    ErrorT$.outboundSchema = exports.ErrorT$outboundSchema;
})(ErrorT$ || (exports.ErrorT$ = ErrorT$ = {}));
function errorToJSON(errorT) {
    return JSON.stringify(exports.ErrorT$outboundSchema.parse(errorT));
}
function errorFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ErrorT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ErrorT' from JSON`);
}
/** @internal */
exports.Event$inboundSchema = z.nativeEnum(exports.Event);
/** @internal */
exports.Event$outboundSchema = exports.Event$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Event$;
(function (Event$) {
    /** @deprecated use `Event$inboundSchema` instead. */
    Event$.inboundSchema = exports.Event$inboundSchema;
    /** @deprecated use `Event$outboundSchema` instead. */
    Event$.outboundSchema = exports.Event$outboundSchema;
})(Event$ || (exports.Event$ = Event$ = {}));
/** @internal */
exports.Batch$inboundSchema = z
    .object({
    data: z.string().transform((v, ctx) => {
        try {
            return JSON.parse(v);
        }
        catch (err) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: `malformed json: ${err}`,
            });
            return z.NEVER;
        }
    }).pipe(readbatch_js_1.ReadBatch$inboundSchema),
    event: exports.Event$inboundSchema,
    id: z.string(),
});
/** @internal */
exports.Batch$outboundSchema = z.object({
    data: readbatch_js_1.ReadBatch$outboundSchema,
    event: exports.Event$outboundSchema,
    id: z.string(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Batch$;
(function (Batch$) {
    /** @deprecated use `Batch$inboundSchema` instead. */
    Batch$.inboundSchema = exports.Batch$inboundSchema;
    /** @deprecated use `Batch$outboundSchema` instead. */
    Batch$.outboundSchema = exports.Batch$outboundSchema;
})(Batch$ || (exports.Batch$ = Batch$ = {}));
function batchToJSON(batch) {
    return JSON.stringify(exports.Batch$outboundSchema.parse(batch));
}
function batchFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Batch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Batch' from JSON`);
}
/** @internal */
exports.ReadEvent$inboundSchema = z.union([
    z.lazy(() => exports.Batch$inboundSchema),
    z.lazy(() => exports.ErrorT$inboundSchema),
    z.lazy(() => exports.Ping$inboundSchema),
]);
/** @internal */
exports.ReadEvent$outboundSchema = z.union([
    z.lazy(() => exports.Batch$outboundSchema),
    z.lazy(() => exports.ErrorT$outboundSchema),
    z.lazy(() => exports.Ping$outboundSchema),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var ReadEvent$;
(function (ReadEvent$) {
    /** @deprecated use `ReadEvent$inboundSchema` instead. */
    ReadEvent$.inboundSchema = exports.ReadEvent$inboundSchema;
    /** @deprecated use `ReadEvent$outboundSchema` instead. */
    ReadEvent$.outboundSchema = exports.ReadEvent$outboundSchema;
})(ReadEvent$ || (exports.ReadEvent$ = ReadEvent$ = {}));
function readEventToJSON(readEvent) {
    return JSON.stringify(exports.ReadEvent$outboundSchema.parse(readEvent));
}
function readEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ReadEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReadEvent' from JSON`);
}
//# sourceMappingURL=readevent.js.map