"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.ReadResponseOutput$ = exports.ReadResponseOutput$outboundSchema = exports.ReadResponseOutput$inboundSchema = exports.ErrorT$ = exports.ErrorT$outboundSchema = exports.ErrorT$inboundSchema = void 0;
exports.errorToJSON = errorToJSON;
exports.errorFromJSON = errorFromJSON;
exports.readResponseOutputToJSON = readResponseOutputToJSON;
exports.readResponseOutputFromJSON = readResponseOutputFromJSON;
exports.readResponseToJSON = readResponseToJSON;
exports.readResponseFromJSON = readResponseFromJSON;
const z = __importStar(require("zod"));
const schemas_js_1 = require("../../lib/schemas.js");
const output_js_1 = require("./output.js");
/** @internal */
exports.ErrorT$inboundSchema = z
    .object({
    data: z.string(),
    event: z.string(),
});
/** @internal */
exports.ErrorT$outboundSchema = z.object({
    data: z.string(),
    event: z.string(),
});
/**
 * @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.ReadResponseOutput$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(output_js_1.Output$inboundSchema),
    event: z.string(),
});
/** @internal */
exports.ReadResponseOutput$outboundSchema = z.object({
    data: output_js_1.Output$outboundSchema,
    event: z.string(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var ReadResponseOutput$;
(function (ReadResponseOutput$) {
    /** @deprecated use `ReadResponseOutput$inboundSchema` instead. */
    ReadResponseOutput$.inboundSchema = exports.ReadResponseOutput$inboundSchema;
    /** @deprecated use `ReadResponseOutput$outboundSchema` instead. */
    ReadResponseOutput$.outboundSchema = exports.ReadResponseOutput$outboundSchema;
})(ReadResponseOutput$ || (exports.ReadResponseOutput$ = ReadResponseOutput$ = {}));
function readResponseOutputToJSON(readResponseOutput) {
    return JSON.stringify(exports.ReadResponseOutput$outboundSchema.parse(readResponseOutput));
}
function readResponseOutputFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ReadResponseOutput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReadResponseOutput' from JSON`);
}
/** @internal */
exports.ReadResponse$inboundSchema = z.union([
    z.lazy(() => exports.ReadResponseOutput$inboundSchema),
    z.lazy(() => exports.ErrorT$inboundSchema),
]);
/** @internal */
exports.ReadResponse$outboundSchema = z.union([
    z.lazy(() => exports.ReadResponseOutput$outboundSchema),
    z.lazy(() => exports.ErrorT$outboundSchema),
]);
/**
 * @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=readresponse.js.map