/*
 * 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 UnauthorizedRequestResponseError1 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 = "UnauthorizedRequestResponseError1";
    }
}
export class UnauthorizedRequestResponseError2 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 = "UnauthorizedRequestResponseError2";
    }
}
/** @internal */
export const UnauthorizedRequestResponseImsxCodeMinorField1$inboundSchema = z.object({
    imsx_codeMinorFieldName: z.literal("TargetEndSystem").optional(),
    imsx_codeMinorFieldValue: z.literal("unauthorisedrequest").optional(),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorFieldName": "imsxCodeMinorFieldName",
        "imsx_codeMinorFieldValue": "imsxCodeMinorFieldValue",
    });
});
/** @internal */
export const UnauthorizedRequestResponseImsxCodeMinorField1$outboundSchema = z.object({
    imsxCodeMinorFieldName: z.literal("TargetEndSystem").default("TargetEndSystem"),
    imsxCodeMinorFieldValue: z.literal("unauthorisedrequest").default("unauthorisedrequest"),
}).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 UnauthorizedRequestResponseImsxCodeMinorField1$;
(function (UnauthorizedRequestResponseImsxCodeMinorField1$) {
    /** @deprecated use `UnauthorizedRequestResponseImsxCodeMinorField1$inboundSchema` instead. */
    UnauthorizedRequestResponseImsxCodeMinorField1$.inboundSchema = UnauthorizedRequestResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `UnauthorizedRequestResponseImsxCodeMinorField1$outboundSchema` instead. */
    UnauthorizedRequestResponseImsxCodeMinorField1$.outboundSchema = UnauthorizedRequestResponseImsxCodeMinorField1$outboundSchema;
})(UnauthorizedRequestResponseImsxCodeMinorField1$ || (UnauthorizedRequestResponseImsxCodeMinorField1$ = {}));
export function unauthorizedRequestResponseImsxCodeMinorField1ToJSON(unauthorizedRequestResponseImsxCodeMinorField1) {
    return JSON.stringify(UnauthorizedRequestResponseImsxCodeMinorField1$outboundSchema.parse(unauthorizedRequestResponseImsxCodeMinorField1));
}
export function unauthorizedRequestResponseImsxCodeMinorField1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => UnauthorizedRequestResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UnauthorizedRequestResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
export const UnauthorizedRequestResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => UnauthorizedRequestResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
export const UnauthorizedRequestResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => UnauthorizedRequestResponseImsxCodeMinorField1$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 UnauthorizedRequestResponseImsxCodeMinor$;
(function (UnauthorizedRequestResponseImsxCodeMinor$) {
    /** @deprecated use `UnauthorizedRequestResponseImsxCodeMinor$inboundSchema` instead. */
    UnauthorizedRequestResponseImsxCodeMinor$.inboundSchema = UnauthorizedRequestResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `UnauthorizedRequestResponseImsxCodeMinor$outboundSchema` instead. */
    UnauthorizedRequestResponseImsxCodeMinor$.outboundSchema = UnauthorizedRequestResponseImsxCodeMinor$outboundSchema;
})(UnauthorizedRequestResponseImsxCodeMinor$ || (UnauthorizedRequestResponseImsxCodeMinor$ = {}));
export function unauthorizedRequestResponseImsxCodeMinorToJSON(unauthorizedRequestResponseImsxCodeMinor) {
    return JSON.stringify(UnauthorizedRequestResponseImsxCodeMinor$outboundSchema.parse(unauthorizedRequestResponseImsxCodeMinor));
}
export function unauthorizedRequestResponseImsxCodeMinorFromJSON(jsonString) {
    return safeParse(jsonString, (x) => UnauthorizedRequestResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UnauthorizedRequestResponseImsxCodeMinor' from JSON`);
}
/** @internal */
export const UnauthorizedRequestResponseError1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => UnauthorizedRequestResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new UnauthorizedRequestResponseError1(remapped);
});
/** @internal */
export const UnauthorizedRequestResponseError1$outboundSchema = z.instanceof(UnauthorizedRequestResponseError1)
    .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(() => UnauthorizedRequestResponseImsxCodeMinor$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 UnauthorizedRequestResponseError1$;
(function (UnauthorizedRequestResponseError1$) {
    /** @deprecated use `UnauthorizedRequestResponseError1$inboundSchema` instead. */
    UnauthorizedRequestResponseError1$.inboundSchema = UnauthorizedRequestResponseError1$inboundSchema;
    /** @deprecated use `UnauthorizedRequestResponseError1$outboundSchema` instead. */
    UnauthorizedRequestResponseError1$.outboundSchema = UnauthorizedRequestResponseError1$outboundSchema;
})(UnauthorizedRequestResponseError1$ || (UnauthorizedRequestResponseError1$ = {}));
/** @internal */
export const UnauthorizedRequestResponseError2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => UnauthorizedRequestResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new UnauthorizedRequestResponseError2(remapped);
});
/** @internal */
export const UnauthorizedRequestResponseError2$outboundSchema = z.instanceof(UnauthorizedRequestResponseError2)
    .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(() => UnauthorizedRequestResponseImsxCodeMinor$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 UnauthorizedRequestResponseError2$;
(function (UnauthorizedRequestResponseError2$) {
    /** @deprecated use `UnauthorizedRequestResponseError2$inboundSchema` instead. */
    UnauthorizedRequestResponseError2$.inboundSchema = UnauthorizedRequestResponseError2$inboundSchema;
    /** @deprecated use `UnauthorizedRequestResponseError2$outboundSchema` instead. */
    UnauthorizedRequestResponseError2$.outboundSchema = UnauthorizedRequestResponseError2$outboundSchema;
})(UnauthorizedRequestResponseError2$ || (UnauthorizedRequestResponseError2$ = {}));
//# sourceMappingURL=unauthorizedrequestresponseerror1.js.map