/*
 * 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 UnprocessableEntityResponseError1 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 = "UnprocessableEntityResponseError1";
    }
}
export class UnprocessableEntityResponseError2 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 = "UnprocessableEntityResponseError2";
    }
}
/** @internal */
export const UnprocessableEntityResponseImsxCodeMinorField1$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 UnprocessableEntityResponseImsxCodeMinorField1$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 UnprocessableEntityResponseImsxCodeMinorField1$;
(function (UnprocessableEntityResponseImsxCodeMinorField1$) {
    /** @deprecated use `UnprocessableEntityResponseImsxCodeMinorField1$inboundSchema` instead. */
    UnprocessableEntityResponseImsxCodeMinorField1$.inboundSchema = UnprocessableEntityResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `UnprocessableEntityResponseImsxCodeMinorField1$outboundSchema` instead. */
    UnprocessableEntityResponseImsxCodeMinorField1$.outboundSchema = UnprocessableEntityResponseImsxCodeMinorField1$outboundSchema;
})(UnprocessableEntityResponseImsxCodeMinorField1$ || (UnprocessableEntityResponseImsxCodeMinorField1$ = {}));
export function unprocessableEntityResponseImsxCodeMinorField1ToJSON(unprocessableEntityResponseImsxCodeMinorField1) {
    return JSON.stringify(UnprocessableEntityResponseImsxCodeMinorField1$outboundSchema.parse(unprocessableEntityResponseImsxCodeMinorField1));
}
export function unprocessableEntityResponseImsxCodeMinorField1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => UnprocessableEntityResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UnprocessableEntityResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
export const UnprocessableEntityResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => UnprocessableEntityResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
export const UnprocessableEntityResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => UnprocessableEntityResponseImsxCodeMinorField1$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 UnprocessableEntityResponseImsxCodeMinor$;
(function (UnprocessableEntityResponseImsxCodeMinor$) {
    /** @deprecated use `UnprocessableEntityResponseImsxCodeMinor$inboundSchema` instead. */
    UnprocessableEntityResponseImsxCodeMinor$.inboundSchema = UnprocessableEntityResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `UnprocessableEntityResponseImsxCodeMinor$outboundSchema` instead. */
    UnprocessableEntityResponseImsxCodeMinor$.outboundSchema = UnprocessableEntityResponseImsxCodeMinor$outboundSchema;
})(UnprocessableEntityResponseImsxCodeMinor$ || (UnprocessableEntityResponseImsxCodeMinor$ = {}));
export function unprocessableEntityResponseImsxCodeMinorToJSON(unprocessableEntityResponseImsxCodeMinor) {
    return JSON.stringify(UnprocessableEntityResponseImsxCodeMinor$outboundSchema.parse(unprocessableEntityResponseImsxCodeMinor));
}
export function unprocessableEntityResponseImsxCodeMinorFromJSON(jsonString) {
    return safeParse(jsonString, (x) => UnprocessableEntityResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UnprocessableEntityResponseImsxCodeMinor' from JSON`);
}
/** @internal */
export const UnprocessableEntityResponseError1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => UnprocessableEntityResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new UnprocessableEntityResponseError1(remapped);
});
/** @internal */
export const UnprocessableEntityResponseError1$outboundSchema = z.instanceof(UnprocessableEntityResponseError1)
    .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(() => UnprocessableEntityResponseImsxCodeMinor$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 UnprocessableEntityResponseError1$;
(function (UnprocessableEntityResponseError1$) {
    /** @deprecated use `UnprocessableEntityResponseError1$inboundSchema` instead. */
    UnprocessableEntityResponseError1$.inboundSchema = UnprocessableEntityResponseError1$inboundSchema;
    /** @deprecated use `UnprocessableEntityResponseError1$outboundSchema` instead. */
    UnprocessableEntityResponseError1$.outboundSchema = UnprocessableEntityResponseError1$outboundSchema;
})(UnprocessableEntityResponseError1$ || (UnprocessableEntityResponseError1$ = {}));
/** @internal */
export const UnprocessableEntityResponseError2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => UnprocessableEntityResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new UnprocessableEntityResponseError2(remapped);
});
/** @internal */
export const UnprocessableEntityResponseError2$outboundSchema = z.instanceof(UnprocessableEntityResponseError2)
    .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(() => UnprocessableEntityResponseImsxCodeMinor$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 UnprocessableEntityResponseError2$;
(function (UnprocessableEntityResponseError2$) {
    /** @deprecated use `UnprocessableEntityResponseError2$inboundSchema` instead. */
    UnprocessableEntityResponseError2$.inboundSchema = UnprocessableEntityResponseError2$inboundSchema;
    /** @deprecated use `UnprocessableEntityResponseError2$outboundSchema` instead. */
    UnprocessableEntityResponseError2$.outboundSchema = UnprocessableEntityResponseError2$outboundSchema;
})(UnprocessableEntityResponseError2$ || (UnprocessableEntityResponseError2$ = {}));
//# sourceMappingURL=unprocessableentityresponseerror1.js.map