/*
 * 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 BadRequestResponseError1 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 = "BadRequestResponseError1";
    }
}
export class BadRequestResponseError2 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 = "BadRequestResponseError2";
    }
}
/** @internal */
export const BadRequestResponseImsxCodeMinorField1$inboundSchema = z.object({
    imsx_codeMinorFieldName: z.literal("TargetEndSystem").optional(),
    imsx_codeMinorFieldValue: z.literal("invaliddata").optional(),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorFieldName": "imsxCodeMinorFieldName",
        "imsx_codeMinorFieldValue": "imsxCodeMinorFieldValue",
    });
});
/** @internal */
export const BadRequestResponseImsxCodeMinorField1$outboundSchema = z.object({
    imsxCodeMinorFieldName: z.literal("TargetEndSystem").default("TargetEndSystem"),
    imsxCodeMinorFieldValue: z.literal("invaliddata").default("invaliddata"),
}).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 BadRequestResponseImsxCodeMinorField1$;
(function (BadRequestResponseImsxCodeMinorField1$) {
    /** @deprecated use `BadRequestResponseImsxCodeMinorField1$inboundSchema` instead. */
    BadRequestResponseImsxCodeMinorField1$.inboundSchema = BadRequestResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `BadRequestResponseImsxCodeMinorField1$outboundSchema` instead. */
    BadRequestResponseImsxCodeMinorField1$.outboundSchema = BadRequestResponseImsxCodeMinorField1$outboundSchema;
})(BadRequestResponseImsxCodeMinorField1$ || (BadRequestResponseImsxCodeMinorField1$ = {}));
export function badRequestResponseImsxCodeMinorField1ToJSON(badRequestResponseImsxCodeMinorField1) {
    return JSON.stringify(BadRequestResponseImsxCodeMinorField1$outboundSchema.parse(badRequestResponseImsxCodeMinorField1));
}
export function badRequestResponseImsxCodeMinorField1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => BadRequestResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BadRequestResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
export const BadRequestResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => BadRequestResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
export const BadRequestResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => BadRequestResponseImsxCodeMinorField1$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 BadRequestResponseImsxCodeMinor$;
(function (BadRequestResponseImsxCodeMinor$) {
    /** @deprecated use `BadRequestResponseImsxCodeMinor$inboundSchema` instead. */
    BadRequestResponseImsxCodeMinor$.inboundSchema = BadRequestResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `BadRequestResponseImsxCodeMinor$outboundSchema` instead. */
    BadRequestResponseImsxCodeMinor$.outboundSchema = BadRequestResponseImsxCodeMinor$outboundSchema;
})(BadRequestResponseImsxCodeMinor$ || (BadRequestResponseImsxCodeMinor$ = {}));
export function badRequestResponseImsxCodeMinorToJSON(badRequestResponseImsxCodeMinor) {
    return JSON.stringify(BadRequestResponseImsxCodeMinor$outboundSchema.parse(badRequestResponseImsxCodeMinor));
}
export function badRequestResponseImsxCodeMinorFromJSON(jsonString) {
    return safeParse(jsonString, (x) => BadRequestResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BadRequestResponseImsxCodeMinor' from JSON`);
}
/** @internal */
export const BadRequestResponseError1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => BadRequestResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new BadRequestResponseError1(remapped);
});
/** @internal */
export const BadRequestResponseError1$outboundSchema = z.instanceof(BadRequestResponseError1)
    .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(() => BadRequestResponseImsxCodeMinor$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 BadRequestResponseError1$;
(function (BadRequestResponseError1$) {
    /** @deprecated use `BadRequestResponseError1$inboundSchema` instead. */
    BadRequestResponseError1$.inboundSchema = BadRequestResponseError1$inboundSchema;
    /** @deprecated use `BadRequestResponseError1$outboundSchema` instead. */
    BadRequestResponseError1$.outboundSchema = BadRequestResponseError1$outboundSchema;
})(BadRequestResponseError1$ || (BadRequestResponseError1$ = {}));
/** @internal */
export const BadRequestResponseError2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => BadRequestResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new BadRequestResponseError2(remapped);
});
/** @internal */
export const BadRequestResponseError2$outboundSchema = z.instanceof(BadRequestResponseError2)
    .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(() => BadRequestResponseImsxCodeMinor$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 BadRequestResponseError2$;
(function (BadRequestResponseError2$) {
    /** @deprecated use `BadRequestResponseError2$inboundSchema` instead. */
    BadRequestResponseError2$.inboundSchema = BadRequestResponseError2$inboundSchema;
    /** @deprecated use `BadRequestResponseError2$outboundSchema` instead. */
    BadRequestResponseError2$.outboundSchema = BadRequestResponseError2$outboundSchema;
})(BadRequestResponseError2$ || (BadRequestResponseError2$ = {}));
//# sourceMappingURL=badrequestresponseerror1.js.map