/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
export 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";
    }
}
export 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";
    }
}
/** @internal */
export const InternalServerErrorResponseImsxCodeMinorField1$inboundSchema = z.object({
    imsx_codeMinorFieldName: z.literal("TargetEndSystem").optional(),
    imsx_codeMinorFieldValue: z.literal("internal_server_error").optional(),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorFieldName": "imsxCodeMinorFieldName",
        "imsx_codeMinorFieldValue": "imsxCodeMinorFieldValue",
    });
});
/** @internal */
export const InternalServerErrorResponseImsxCodeMinorField1$outboundSchema = z.object({
    imsxCodeMinorFieldName: z.literal("TargetEndSystem").default("TargetEndSystem"),
    imsxCodeMinorFieldValue: z.literal("internal_server_error").default("internal_server_error"),
}).transform((v) => {
    return 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.
 */
export var InternalServerErrorResponseImsxCodeMinorField1$;
(function (InternalServerErrorResponseImsxCodeMinorField1$) {
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinorField1$inboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinorField1$.inboundSchema = InternalServerErrorResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinorField1$outboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinorField1$.outboundSchema = InternalServerErrorResponseImsxCodeMinorField1$outboundSchema;
})(InternalServerErrorResponseImsxCodeMinorField1$ || (InternalServerErrorResponseImsxCodeMinorField1$ = {}));
export function internalServerErrorResponseImsxCodeMinorField1ToJSON(internalServerErrorResponseImsxCodeMinorField1) {
    return JSON.stringify(InternalServerErrorResponseImsxCodeMinorField1$outboundSchema.parse(internalServerErrorResponseImsxCodeMinorField1));
}
export function internalServerErrorResponseImsxCodeMinorField1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => InternalServerErrorResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalServerErrorResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
export const InternalServerErrorResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => InternalServerErrorResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
export const InternalServerErrorResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => InternalServerErrorResponseImsxCodeMinorField1$outboundSchema)),
}).transform((v) => {
    return 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.
 */
export var InternalServerErrorResponseImsxCodeMinor$;
(function (InternalServerErrorResponseImsxCodeMinor$) {
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinor$inboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinor$.inboundSchema = InternalServerErrorResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `InternalServerErrorResponseImsxCodeMinor$outboundSchema` instead. */
    InternalServerErrorResponseImsxCodeMinor$.outboundSchema = InternalServerErrorResponseImsxCodeMinor$outboundSchema;
})(InternalServerErrorResponseImsxCodeMinor$ || (InternalServerErrorResponseImsxCodeMinor$ = {}));
export function internalServerErrorResponseImsxCodeMinorToJSON(internalServerErrorResponseImsxCodeMinor) {
    return JSON.stringify(InternalServerErrorResponseImsxCodeMinor$outboundSchema.parse(internalServerErrorResponseImsxCodeMinor));
}
export function internalServerErrorResponseImsxCodeMinorFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InternalServerErrorResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalServerErrorResponseImsxCodeMinor' from JSON`);
}
/** @internal */
export const InternalServerErrorResponse1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => InternalServerErrorResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new InternalServerErrorResponse1(remapped);
});
/** @internal */
export const 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(() => InternalServerErrorResponseImsxCodeMinor$outboundSchema),
}).transform((v) => {
    return 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.
 */
export var InternalServerErrorResponse1$;
(function (InternalServerErrorResponse1$) {
    /** @deprecated use `InternalServerErrorResponse1$inboundSchema` instead. */
    InternalServerErrorResponse1$.inboundSchema = InternalServerErrorResponse1$inboundSchema;
    /** @deprecated use `InternalServerErrorResponse1$outboundSchema` instead. */
    InternalServerErrorResponse1$.outboundSchema = InternalServerErrorResponse1$outboundSchema;
})(InternalServerErrorResponse1$ || (InternalServerErrorResponse1$ = {}));
/** @internal */
export const InternalServerErrorResponse2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => InternalServerErrorResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new InternalServerErrorResponse2(remapped);
});
/** @internal */
export const 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(() => InternalServerErrorResponseImsxCodeMinor$outboundSchema),
}).transform((v) => {
    return 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.
 */
export var InternalServerErrorResponse2$;
(function (InternalServerErrorResponse2$) {
    /** @deprecated use `InternalServerErrorResponse2$inboundSchema` instead. */
    InternalServerErrorResponse2$.inboundSchema = InternalServerErrorResponse2$inboundSchema;
    /** @deprecated use `InternalServerErrorResponse2$outboundSchema` instead. */
    InternalServerErrorResponse2$.outboundSchema = InternalServerErrorResponse2$outboundSchema;
})(InternalServerErrorResponse2$ || (InternalServerErrorResponse2$ = {}));
//# sourceMappingURL=internalservererrorresponse1.js.map