/*
 * 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 TooManyRequestsResponseError1 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 = "TooManyRequestsResponseError1";
    }
}
export class TooManyRequestsResponseError2 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 = "TooManyRequestsResponseError2";
    }
}
/** @internal */
export const TooManyRequestsResponseImsxCodeMinorField1$inboundSchema = z.object({
    imsx_codeMinorFieldName: z.literal("TargetEndSystem").optional(),
    imsx_codeMinorFieldValue: z.literal("server_busy").optional(),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorFieldName": "imsxCodeMinorFieldName",
        "imsx_codeMinorFieldValue": "imsxCodeMinorFieldValue",
    });
});
/** @internal */
export const TooManyRequestsResponseImsxCodeMinorField1$outboundSchema = z.object({
    imsxCodeMinorFieldName: z.literal("TargetEndSystem").default("TargetEndSystem"),
    imsxCodeMinorFieldValue: z.literal("server_busy").default("server_busy"),
}).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 TooManyRequestsResponseImsxCodeMinorField1$;
(function (TooManyRequestsResponseImsxCodeMinorField1$) {
    /** @deprecated use `TooManyRequestsResponseImsxCodeMinorField1$inboundSchema` instead. */
    TooManyRequestsResponseImsxCodeMinorField1$.inboundSchema = TooManyRequestsResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `TooManyRequestsResponseImsxCodeMinorField1$outboundSchema` instead. */
    TooManyRequestsResponseImsxCodeMinorField1$.outboundSchema = TooManyRequestsResponseImsxCodeMinorField1$outboundSchema;
})(TooManyRequestsResponseImsxCodeMinorField1$ || (TooManyRequestsResponseImsxCodeMinorField1$ = {}));
export function tooManyRequestsResponseImsxCodeMinorField1ToJSON(tooManyRequestsResponseImsxCodeMinorField1) {
    return JSON.stringify(TooManyRequestsResponseImsxCodeMinorField1$outboundSchema.parse(tooManyRequestsResponseImsxCodeMinorField1));
}
export function tooManyRequestsResponseImsxCodeMinorField1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => TooManyRequestsResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TooManyRequestsResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
export const TooManyRequestsResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => TooManyRequestsResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
export const TooManyRequestsResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => TooManyRequestsResponseImsxCodeMinorField1$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 TooManyRequestsResponseImsxCodeMinor$;
(function (TooManyRequestsResponseImsxCodeMinor$) {
    /** @deprecated use `TooManyRequestsResponseImsxCodeMinor$inboundSchema` instead. */
    TooManyRequestsResponseImsxCodeMinor$.inboundSchema = TooManyRequestsResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `TooManyRequestsResponseImsxCodeMinor$outboundSchema` instead. */
    TooManyRequestsResponseImsxCodeMinor$.outboundSchema = TooManyRequestsResponseImsxCodeMinor$outboundSchema;
})(TooManyRequestsResponseImsxCodeMinor$ || (TooManyRequestsResponseImsxCodeMinor$ = {}));
export function tooManyRequestsResponseImsxCodeMinorToJSON(tooManyRequestsResponseImsxCodeMinor) {
    return JSON.stringify(TooManyRequestsResponseImsxCodeMinor$outboundSchema.parse(tooManyRequestsResponseImsxCodeMinor));
}
export function tooManyRequestsResponseImsxCodeMinorFromJSON(jsonString) {
    return safeParse(jsonString, (x) => TooManyRequestsResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TooManyRequestsResponseImsxCodeMinor' from JSON`);
}
/** @internal */
export const TooManyRequestsResponseError1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => TooManyRequestsResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new TooManyRequestsResponseError1(remapped);
});
/** @internal */
export const TooManyRequestsResponseError1$outboundSchema = z.instanceof(TooManyRequestsResponseError1)
    .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(() => TooManyRequestsResponseImsxCodeMinor$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 TooManyRequestsResponseError1$;
(function (TooManyRequestsResponseError1$) {
    /** @deprecated use `TooManyRequestsResponseError1$inboundSchema` instead. */
    TooManyRequestsResponseError1$.inboundSchema = TooManyRequestsResponseError1$inboundSchema;
    /** @deprecated use `TooManyRequestsResponseError1$outboundSchema` instead. */
    TooManyRequestsResponseError1$.outboundSchema = TooManyRequestsResponseError1$outboundSchema;
})(TooManyRequestsResponseError1$ || (TooManyRequestsResponseError1$ = {}));
/** @internal */
export const TooManyRequestsResponseError2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => TooManyRequestsResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new TooManyRequestsResponseError2(remapped);
});
/** @internal */
export const TooManyRequestsResponseError2$outboundSchema = z.instanceof(TooManyRequestsResponseError2)
    .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(() => TooManyRequestsResponseImsxCodeMinor$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 TooManyRequestsResponseError2$;
(function (TooManyRequestsResponseError2$) {
    /** @deprecated use `TooManyRequestsResponseError2$inboundSchema` instead. */
    TooManyRequestsResponseError2$.inboundSchema = TooManyRequestsResponseError2$inboundSchema;
    /** @deprecated use `TooManyRequestsResponseError2$outboundSchema` instead. */
    TooManyRequestsResponseError2$.outboundSchema = TooManyRequestsResponseError2$outboundSchema;
})(TooManyRequestsResponseError2$ || (TooManyRequestsResponseError2$ = {}));
//# sourceMappingURL=toomanyrequestsresponseerror1.js.map