/*
 * 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 ForbiddenResponseError1 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 = "ForbiddenResponseError1";
    }
}
export class ForbiddenResponseError2 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 = "ForbiddenResponseError2";
    }
}
/** @internal */
export const ForbiddenResponseImsxCodeMinorField1$inboundSchema = z.object({
    imsx_codeMinorFieldName: z.literal("TargetEndSystem").optional(),
    imsx_codeMinorFieldValue: z.literal("forbidden").optional(),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorFieldName": "imsxCodeMinorFieldName",
        "imsx_codeMinorFieldValue": "imsxCodeMinorFieldValue",
    });
});
/** @internal */
export const ForbiddenResponseImsxCodeMinorField1$outboundSchema = z.object({
    imsxCodeMinorFieldName: z.literal("TargetEndSystem").default("TargetEndSystem"),
    imsxCodeMinorFieldValue: z.literal("forbidden").default("forbidden"),
}).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 ForbiddenResponseImsxCodeMinorField1$;
(function (ForbiddenResponseImsxCodeMinorField1$) {
    /** @deprecated use `ForbiddenResponseImsxCodeMinorField1$inboundSchema` instead. */
    ForbiddenResponseImsxCodeMinorField1$.inboundSchema = ForbiddenResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `ForbiddenResponseImsxCodeMinorField1$outboundSchema` instead. */
    ForbiddenResponseImsxCodeMinorField1$.outboundSchema = ForbiddenResponseImsxCodeMinorField1$outboundSchema;
})(ForbiddenResponseImsxCodeMinorField1$ || (ForbiddenResponseImsxCodeMinorField1$ = {}));
export function forbiddenResponseImsxCodeMinorField1ToJSON(forbiddenResponseImsxCodeMinorField1) {
    return JSON.stringify(ForbiddenResponseImsxCodeMinorField1$outboundSchema.parse(forbiddenResponseImsxCodeMinorField1));
}
export function forbiddenResponseImsxCodeMinorField1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => ForbiddenResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ForbiddenResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
export const ForbiddenResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => ForbiddenResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return remap$(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
export const ForbiddenResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => ForbiddenResponseImsxCodeMinorField1$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 ForbiddenResponseImsxCodeMinor$;
(function (ForbiddenResponseImsxCodeMinor$) {
    /** @deprecated use `ForbiddenResponseImsxCodeMinor$inboundSchema` instead. */
    ForbiddenResponseImsxCodeMinor$.inboundSchema = ForbiddenResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `ForbiddenResponseImsxCodeMinor$outboundSchema` instead. */
    ForbiddenResponseImsxCodeMinor$.outboundSchema = ForbiddenResponseImsxCodeMinor$outboundSchema;
})(ForbiddenResponseImsxCodeMinor$ || (ForbiddenResponseImsxCodeMinor$ = {}));
export function forbiddenResponseImsxCodeMinorToJSON(forbiddenResponseImsxCodeMinor) {
    return JSON.stringify(ForbiddenResponseImsxCodeMinor$outboundSchema.parse(forbiddenResponseImsxCodeMinor));
}
export function forbiddenResponseImsxCodeMinorFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ForbiddenResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ForbiddenResponseImsxCodeMinor' from JSON`);
}
/** @internal */
export const ForbiddenResponseError1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => ForbiddenResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new ForbiddenResponseError1(remapped);
});
/** @internal */
export const ForbiddenResponseError1$outboundSchema = z.instanceof(ForbiddenResponseError1)
    .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(() => ForbiddenResponseImsxCodeMinor$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 ForbiddenResponseError1$;
(function (ForbiddenResponseError1$) {
    /** @deprecated use `ForbiddenResponseError1$inboundSchema` instead. */
    ForbiddenResponseError1$.inboundSchema = ForbiddenResponseError1$inboundSchema;
    /** @deprecated use `ForbiddenResponseError1$outboundSchema` instead. */
    ForbiddenResponseError1$.outboundSchema = ForbiddenResponseError1$outboundSchema;
})(ForbiddenResponseError1$ || (ForbiddenResponseError1$ = {}));
/** @internal */
export const ForbiddenResponseError2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => ForbiddenResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = remap$(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new ForbiddenResponseError2(remapped);
});
/** @internal */
export const ForbiddenResponseError2$outboundSchema = z.instanceof(ForbiddenResponseError2)
    .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(() => ForbiddenResponseImsxCodeMinor$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 ForbiddenResponseError2$;
(function (ForbiddenResponseError2$) {
    /** @deprecated use `ForbiddenResponseError2$inboundSchema` instead. */
    ForbiddenResponseError2$.inboundSchema = ForbiddenResponseError2$inboundSchema;
    /** @deprecated use `ForbiddenResponseError2$outboundSchema` instead. */
    ForbiddenResponseError2$.outboundSchema = ForbiddenResponseError2$outboundSchema;
})(ForbiddenResponseError2$ || (ForbiddenResponseError2$ = {}));
//# sourceMappingURL=forbiddenresponseerror1.js.map