/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import * as operations from "../operations/index.js";
import { CloudinaryAssetMgmtError } from "./cloudinaryassetmgmterror.js";
/**
 * Version not found
 */
export class NotFoundError extends CloudinaryAssetMgmtError {
    constructor(err, httpMeta) {
        const message = "message" in err && typeof err.message === "string"
            ? err.message
            : `API error occurred: ${JSON.stringify(err)}`;
        super(message, httpMeta);
        this.data$ = err;
        if (err.error != null)
            this.error = err.error;
        this.name = "NotFoundError";
    }
}
/**
 * Authentication failed
 */
export class DownloadBackupAssetUnauthorizedError extends CloudinaryAssetMgmtError {
    constructor(err, httpMeta) {
        const message = "message" in err && typeof err.message === "string"
            ? err.message
            : `API error occurred: ${JSON.stringify(err)}`;
        super(message, httpMeta);
        this.data$ = err;
        if (err.error != null)
            this.error = err.error;
        this.name = "DownloadBackupAssetUnauthorizedError";
    }
}
/**
 * Bad request
 */
export class BadRequestError extends CloudinaryAssetMgmtError {
    constructor(err, httpMeta) {
        const message = "message" in err && typeof err.message === "string"
            ? err.message
            : `API error occurred: ${JSON.stringify(err)}`;
        super(message, httpMeta);
        this.data$ = err;
        if (err.error != null)
            this.error = err.error;
        this.name = "BadRequestError";
    }
}
/** @internal */
export const NotFoundError$inboundSchema = z.object({
    error: z.lazy(() => operations.NotFoundError$inboundSchema).optional(),
    request$: z.instanceof(Request),
    response$: z.instanceof(Response),
    body$: z.string(),
})
    .transform((v) => {
    return new NotFoundError(v, {
        request: v.request$,
        response: v.response$,
        body: v.body$,
    });
});
/** @internal */
export const NotFoundError$outboundSchema = z.instanceof(NotFoundError)
    .transform(v => v.data$)
    .pipe(z.object({
    error: z.lazy(() => operations.NotFoundError$outboundSchema).optional(),
}));
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var NotFoundError$;
(function (NotFoundError$) {
    /** @deprecated use `NotFoundError$inboundSchema` instead. */
    NotFoundError$.inboundSchema = NotFoundError$inboundSchema;
    /** @deprecated use `NotFoundError$outboundSchema` instead. */
    NotFoundError$.outboundSchema = NotFoundError$outboundSchema;
})(NotFoundError$ || (NotFoundError$ = {}));
/** @internal */
export const DownloadBackupAssetUnauthorizedError$inboundSchema = z.object({
    error: z.lazy(() => operations.DownloadBackupAssetUnauthorizedError$inboundSchema).optional(),
    request$: z.instanceof(Request),
    response$: z.instanceof(Response),
    body$: z.string(),
})
    .transform((v) => {
    return new DownloadBackupAssetUnauthorizedError(v, {
        request: v.request$,
        response: v.response$,
        body: v.body$,
    });
});
/** @internal */
export const DownloadBackupAssetUnauthorizedError$outboundSchema = z.instanceof(DownloadBackupAssetUnauthorizedError)
    .transform(v => v.data$)
    .pipe(z.object({
    error: z.lazy(() => operations.DownloadBackupAssetUnauthorizedError$outboundSchema).optional(),
}));
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var DownloadBackupAssetUnauthorizedError$;
(function (DownloadBackupAssetUnauthorizedError$) {
    /** @deprecated use `DownloadBackupAssetUnauthorizedError$inboundSchema` instead. */
    DownloadBackupAssetUnauthorizedError$.inboundSchema = DownloadBackupAssetUnauthorizedError$inboundSchema;
    /** @deprecated use `DownloadBackupAssetUnauthorizedError$outboundSchema` instead. */
    DownloadBackupAssetUnauthorizedError$.outboundSchema = DownloadBackupAssetUnauthorizedError$outboundSchema;
})(DownloadBackupAssetUnauthorizedError$ || (DownloadBackupAssetUnauthorizedError$ = {}));
/** @internal */
export const BadRequestError$inboundSchema = z.object({
    error: z.lazy(() => operations.BadRequestError$inboundSchema).optional(),
    request$: z.instanceof(Request),
    response$: z.instanceof(Response),
    body$: z.string(),
})
    .transform((v) => {
    return new BadRequestError(v, {
        request: v.request$,
        response: v.response$,
        body: v.body$,
    });
});
/** @internal */
export const BadRequestError$outboundSchema = z.instanceof(BadRequestError)
    .transform(v => v.data$)
    .pipe(z.object({
    error: z.lazy(() => operations.BadRequestError$outboundSchema).optional(),
}));
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var BadRequestError$;
(function (BadRequestError$) {
    /** @deprecated use `BadRequestError$inboundSchema` instead. */
    BadRequestError$.inboundSchema = BadRequestError$inboundSchema;
    /** @deprecated use `BadRequestError$outboundSchema` instead. */
    BadRequestError$.outboundSchema = BadRequestError$outboundSchema;
})(BadRequestError$ || (BadRequestError$ = {}));
//# sourceMappingURL=downloadbackupasset.js.map