"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadRequestResponseError2$ = exports.BadRequestResponseError2$outboundSchema = exports.BadRequestResponseError2$inboundSchema = exports.BadRequestResponseError1$ = exports.BadRequestResponseError1$outboundSchema = exports.BadRequestResponseError1$inboundSchema = exports.BadRequestResponseImsxCodeMinor$ = exports.BadRequestResponseImsxCodeMinor$outboundSchema = exports.BadRequestResponseImsxCodeMinor$inboundSchema = exports.BadRequestResponseImsxCodeMinorField1$ = exports.BadRequestResponseImsxCodeMinorField1$outboundSchema = exports.BadRequestResponseImsxCodeMinorField1$inboundSchema = exports.BadRequestResponseError2 = exports.BadRequestResponseError1 = void 0;
exports.badRequestResponseImsxCodeMinorField1ToJSON = badRequestResponseImsxCodeMinorField1ToJSON;
exports.badRequestResponseImsxCodeMinorField1FromJSON = badRequestResponseImsxCodeMinorField1FromJSON;
exports.badRequestResponseImsxCodeMinorToJSON = badRequestResponseImsxCodeMinorToJSON;
exports.badRequestResponseImsxCodeMinorFromJSON = badRequestResponseImsxCodeMinorFromJSON;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
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";
    }
}
exports.BadRequestResponseError1 = BadRequestResponseError1;
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";
    }
}
exports.BadRequestResponseError2 = BadRequestResponseError2;
/** @internal */
exports.BadRequestResponseImsxCodeMinorField1$inboundSchema = z.object({
    imsx_codeMinorFieldName: z.literal("TargetEndSystem").optional(),
    imsx_codeMinorFieldValue: z.literal("invaliddata").optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "imsx_codeMinorFieldName": "imsxCodeMinorFieldName",
        "imsx_codeMinorFieldValue": "imsxCodeMinorFieldValue",
    });
});
/** @internal */
exports.BadRequestResponseImsxCodeMinorField1$outboundSchema = z.object({
    imsxCodeMinorFieldName: z.literal("TargetEndSystem").default("TargetEndSystem"),
    imsxCodeMinorFieldValue: z.literal("invaliddata").default("invaliddata"),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var BadRequestResponseImsxCodeMinorField1$;
(function (BadRequestResponseImsxCodeMinorField1$) {
    /** @deprecated use `BadRequestResponseImsxCodeMinorField1$inboundSchema` instead. */
    BadRequestResponseImsxCodeMinorField1$.inboundSchema = exports.BadRequestResponseImsxCodeMinorField1$inboundSchema;
    /** @deprecated use `BadRequestResponseImsxCodeMinorField1$outboundSchema` instead. */
    BadRequestResponseImsxCodeMinorField1$.outboundSchema = exports.BadRequestResponseImsxCodeMinorField1$outboundSchema;
})(BadRequestResponseImsxCodeMinorField1$ || (exports.BadRequestResponseImsxCodeMinorField1$ = BadRequestResponseImsxCodeMinorField1$ = {}));
function badRequestResponseImsxCodeMinorField1ToJSON(badRequestResponseImsxCodeMinorField1) {
    return JSON.stringify(exports.BadRequestResponseImsxCodeMinorField1$outboundSchema.parse(badRequestResponseImsxCodeMinorField1));
}
function badRequestResponseImsxCodeMinorField1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.BadRequestResponseImsxCodeMinorField1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BadRequestResponseImsxCodeMinorField1' from JSON`);
}
/** @internal */
exports.BadRequestResponseImsxCodeMinor$inboundSchema = z.object({
    imsx_codeMinorField: z.array(z.lazy(() => exports.BadRequestResponseImsxCodeMinorField1$inboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "imsx_codeMinorField": "imsxCodeMinorField",
    });
});
/** @internal */
exports.BadRequestResponseImsxCodeMinor$outboundSchema = z.object({
    imsxCodeMinorField: z.array(z.lazy(() => exports.BadRequestResponseImsxCodeMinorField1$outboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var BadRequestResponseImsxCodeMinor$;
(function (BadRequestResponseImsxCodeMinor$) {
    /** @deprecated use `BadRequestResponseImsxCodeMinor$inboundSchema` instead. */
    BadRequestResponseImsxCodeMinor$.inboundSchema = exports.BadRequestResponseImsxCodeMinor$inboundSchema;
    /** @deprecated use `BadRequestResponseImsxCodeMinor$outboundSchema` instead. */
    BadRequestResponseImsxCodeMinor$.outboundSchema = exports.BadRequestResponseImsxCodeMinor$outboundSchema;
})(BadRequestResponseImsxCodeMinor$ || (exports.BadRequestResponseImsxCodeMinor$ = BadRequestResponseImsxCodeMinor$ = {}));
function badRequestResponseImsxCodeMinorToJSON(badRequestResponseImsxCodeMinor) {
    return JSON.stringify(exports.BadRequestResponseImsxCodeMinor$outboundSchema.parse(badRequestResponseImsxCodeMinor));
}
function badRequestResponseImsxCodeMinorFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.BadRequestResponseImsxCodeMinor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BadRequestResponseImsxCodeMinor' from JSON`);
}
/** @internal */
exports.BadRequestResponseError1$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => exports.BadRequestResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = (0, primitives_js_1.remap)(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new BadRequestResponseError1(remapped);
});
/** @internal */
exports.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(() => exports.BadRequestResponseImsxCodeMinor$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var BadRequestResponseError1$;
(function (BadRequestResponseError1$) {
    /** @deprecated use `BadRequestResponseError1$inboundSchema` instead. */
    BadRequestResponseError1$.inboundSchema = exports.BadRequestResponseError1$inboundSchema;
    /** @deprecated use `BadRequestResponseError1$outboundSchema` instead. */
    BadRequestResponseError1$.outboundSchema = exports.BadRequestResponseError1$outboundSchema;
})(BadRequestResponseError1$ || (exports.BadRequestResponseError1$ = BadRequestResponseError1$ = {}));
/** @internal */
exports.BadRequestResponseError2$inboundSchema = z.object({
    imsx_codeMajor: z.literal("failure"),
    imsx_severity: z.literal("error"),
    imsx_description: z.string(),
    imsx_CodeMinor: z.lazy(() => exports.BadRequestResponseImsxCodeMinor$inboundSchema),
})
    .transform((v) => {
    const remapped = (0, primitives_js_1.remap)(v, {
        "imsx_codeMajor": "imsxCodeMajor",
        "imsx_severity": "imsxSeverity",
        "imsx_description": "imsxDescription",
        "imsx_CodeMinor": "imsxCodeMinor",
    });
    return new BadRequestResponseError2(remapped);
});
/** @internal */
exports.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(() => exports.BadRequestResponseImsxCodeMinor$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var BadRequestResponseError2$;
(function (BadRequestResponseError2$) {
    /** @deprecated use `BadRequestResponseError2$inboundSchema` instead. */
    BadRequestResponseError2$.inboundSchema = exports.BadRequestResponseError2$inboundSchema;
    /** @deprecated use `BadRequestResponseError2$outboundSchema` instead. */
    BadRequestResponseError2$.outboundSchema = exports.BadRequestResponseError2$outboundSchema;
})(BadRequestResponseError2$ || (exports.BadRequestResponseError2$ = BadRequestResponseError2$ = {}));
//# sourceMappingURL=badrequestresponseerror1.js.map