"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.InternalServerErrorResponse2$ = exports.InternalServerErrorResponse2$outboundSchema = exports.InternalServerErrorResponse2$inboundSchema = exports.InternalServerErrorResponse1$ = exports.InternalServerErrorResponse1$outboundSchema = exports.InternalServerErrorResponse1$inboundSchema = exports.InternalServerErrorResponseImsxCodeMinor$ = exports.InternalServerErrorResponseImsxCodeMinor$outboundSchema = exports.InternalServerErrorResponseImsxCodeMinor$inboundSchema = exports.InternalServerErrorResponseImsxCodeMinorField1$ = exports.InternalServerErrorResponseImsxCodeMinorField1$outboundSchema = exports.InternalServerErrorResponseImsxCodeMinorField1$inboundSchema = exports.InternalServerErrorResponse2 = exports.InternalServerErrorResponse1 = void 0;
exports.internalServerErrorResponseImsxCodeMinorField1ToJSON = internalServerErrorResponseImsxCodeMinorField1ToJSON;
exports.internalServerErrorResponseImsxCodeMinorField1FromJSON = internalServerErrorResponseImsxCodeMinorField1FromJSON;
exports.internalServerErrorResponseImsxCodeMinorToJSON = internalServerErrorResponseImsxCodeMinorToJSON;
exports.internalServerErrorResponseImsxCodeMinorFromJSON = internalServerErrorResponseImsxCodeMinorFromJSON;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
class InternalServerErrorResponse1 extends Error {
    constructor(err) {
        const message = "message" in err && typeof err.message === "string"
            ? err.message
            : `API error occurred: ${JSON.stringify(err)}`;
        super(message);
        this.data$ = err;
        this.imsxCodeMajor = err.imsxCodeMajor;
        this.imsxSeverity = err.imsxSeverity;
        this.imsxDescription = err.imsxDescription;
        this.imsxCodeMinor = err.imsxCodeMinor;
        this.name = "InternalServerErrorResponse1";
    }
}
exports.InternalServerErrorResponse1 = InternalServerErrorResponse1;
class InternalServerErrorResponse2 extends Error {
    constructor(err) {
        const message = "message" in err && typeof err.message === "string"
            ? err.message
            : `API error occurred: ${JSON.stringify(err)}`;
        super(message);
        this.data$ = err;
        this.imsxCodeMajor = err.imsxCodeMajor;
        this.imsxSeverity = err.imsxSeverity;
        this.imsxDescription = err.imsxDescription;
        this.imsxCodeMinor = err.imsxCodeMinor;
        this.name = "InternalServerErrorResponse2";
    }
}
exports.InternalServerErrorResponse2 = InternalServerErrorResponse2;
/** @internal */
exports.InternalServerErrorResponseImsxCodeMinorField1$inboundSchema = z.object({
    imsx_codeMinorFieldName: z.literal("TargetEndSystem").optional(),
    imsx_codeMinorFieldValue: z.literal("internal_server_error").optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "imsx_codeMinorFieldName": "imsxCodeMinorFieldName",
        "imsx_codeMinorFieldValue": "imsxCodeMinorFieldValue",
    });
});
/** @internal */
exports.InternalServerErrorResponseImsxCodeMinorField1$outboundSchema = z.object({
    imsxCodeMinorFieldName: z.literal("TargetEndSystem").default("TargetEndSystem"),
    imsxCodeMinorFieldValue: z.literal("internal_server_error").default("internal_server_error"),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        imsxCodeMinorFieldName: "imsx_codeMinorFieldName",
        imsxCodeMinorFieldValue: "imsx_codeMinorFieldValue",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var InternalServerErrorResponseImsxCodeMinorField1$;
(function (InternalServerErrorResponseImsxCodeMinorField1$) {
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinorField1$inboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinorField1$.inboundSchema = exports.InternalServerErrorResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinorField1$outboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinorField1$.outboundSchema = exports.InternalServerErrorResponseImsxCodeMinorField1$outboundSchema;
})(InternalServerErrorResponseImsxCodeMinorField1$ || (exports.InternalServerErrorResponseImsxCodeMinorField1$ = InternalServerErrorResponseImsxCodeMinorField1$ = {}));
function internalServerErrorResponseImsxCodeMinorField1ToJSON(internalServerErrorResponseImsxCodeMinorField1) {
    return JSON.stringify(exports.InternalServerErrorResponseImsxCodeMinorField1$outboundSchema.parse(internalServerErrorResponseImsxCodeMinorField1));
}
function internalServerErrorResponseImsxCodeMinorField1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InternalServerErrorResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalServerErrorResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
exports.InternalServerErrorResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => exports.InternalServerErrorResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
exports.InternalServerErrorResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => exports.InternalServerErrorResponseImsxCodeMinorField1$outboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        imsxCodeMinorField: "imsx_codeMinorField",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var InternalServerErrorResponseImsxCodeMinor$;
(function (InternalServerErrorResponseImsxCodeMinor$) {
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinor$inboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinor$.inboundSchema = exports.InternalServerErrorResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinor$outboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinor$.outboundSchema = exports.InternalServerErrorResponseImsxCodeMinor$outboundSchema;
})(InternalServerErrorResponseImsxCodeMinor$ || (exports.InternalServerErrorResponseImsxCodeMinor$ = InternalServerErrorResponseImsxCodeMinor$ = {}));
function internalServerErrorResponseImsxCodeMinorToJSON(internalServerErrorResponseImsxCodeMinor) {
    return JSON.stringify(exports.InternalServerErrorResponseImsxCodeMinor$outboundSchema.parse(internalServerErrorResponseImsxCodeMinor));
}
function internalServerErrorResponseImsxCodeMinorFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InternalServerErrorResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalServerErrorResponseImsxCodeMinor' from JSON`);
}
/** @internal */
exports.InternalServerErrorResponse1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => exports.InternalServerErrorResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = (0, primitives_js_1.remap)(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new InternalServerErrorResponse1(remapped);
});
/** @internal */
exports.InternalServerErrorResponse1$outboundSchema = z.instanceof(InternalServerErrorResponse1)
    .transform(v => v.data$)
    .pipe(z.object({
    imsxCodeMajor: z.literal("failure").default("failure"),
    imsxSeverity: z.literal("error").default("error"),
    imsxDescription: z.string(),
    imsxCodeMinor: z.lazy(() => exports.InternalServerErrorResponseImsxCodeMinor$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        imsxCodeMajor: "imsx_codeMajor",
        imsxSeverity: "imsx_severity",
        imsxDescription: "imsx_description",
        imsxCodeMinor: "imsx_CodeMinor",
    });
}));
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var InternalServerErrorResponse1$;
(function (InternalServerErrorResponse1$) {
    /** @deprecated use `InternalServerErrorResponse1$inboundSchema` instead. */
    InternalServerErrorResponse1$.inboundSchema = exports.InternalServerErrorResponse1$inboundSchema;
    /** @deprecated use `InternalServerErrorResponse1$outboundSchema` instead. */
    InternalServerErrorResponse1$.outboundSchema = exports.InternalServerErrorResponse1$outboundSchema;
})(InternalServerErrorResponse1$ || (exports.InternalServerErrorResponse1$ = InternalServerErrorResponse1$ = {}));
/** @internal */
exports.InternalServerErrorResponse2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => exports.InternalServerErrorResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = (0, primitives_js_1.remap)(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new InternalServerErrorResponse2(remapped);
});
/** @internal */
exports.InternalServerErrorResponse2$outboundSchema = z.instanceof(InternalServerErrorResponse2)
    .transform(v => v.data$)
    .pipe(z.object({
    imsxCodeMajor: z.literal("failure").default("failure"),
    imsxSeverity: z.literal("error").default("error"),
    imsxDescription: z.string(),
    imsxCodeMinor: z.lazy(() => exports.InternalServerErrorResponseImsxCodeMinor$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        imsxCodeMajor: "imsx_codeMajor",
        imsxSeverity: "imsx_severity",
        imsxDescription: "imsx_description",
        imsxCodeMinor: "imsx_CodeMinor",
    });
}));
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var InternalServerErrorResponse2$;
(function (InternalServerErrorResponse2$) {
    /** @deprecated use `InternalServerErrorResponse2$inboundSchema` instead. */
    InternalServerErrorResponse2$.inboundSchema = exports.InternalServerErrorResponse2$inboundSchema;
    /** @deprecated use `InternalServerErrorResponse2$outboundSchema` instead. */
    InternalServerErrorResponse2$.outboundSchema = exports.InternalServerErrorResponse2$outboundSchema;
})(InternalServerErrorResponse2$ || (exports.InternalServerErrorResponse2$ = InternalServerErrorResponse2$ = {}));
//# sourceMappingURL=internalservererrorresponse1.js.map