/*
 * 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";
import { RFCDate } from "../../types/rfcdate.js";
/** @internal */
export const Transformations$inboundSchema = z.object({
    usage: z.number().int().optional(),
});
/** @internal */
export const Transformations$outboundSchema = z.object({
    usage: z.number().int().optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Transformations$;
(function (Transformations$) {
    /** @deprecated use `Transformations$inboundSchema` instead. */
    Transformations$.inboundSchema = Transformations$inboundSchema;
    /** @deprecated use `Transformations$outboundSchema` instead. */
    Transformations$.outboundSchema = Transformations$outboundSchema;
})(Transformations$ || (Transformations$ = {}));
export function transformationsToJSON(transformations) {
    return JSON.stringify(Transformations$outboundSchema.parse(transformations));
}
export function transformationsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Transformations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Transformations' from JSON`);
}
/** @internal */
export const Objects$inboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    used_percent: z.number().optional(),
}).transform((v) => {
    return remap$(v, {
        "used_percent": "usedPercent",
    });
});
/** @internal */
export const Objects$outboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    usedPercent: z.number().optional(),
}).transform((v) => {
    return remap$(v, {
        usedPercent: "used_percent",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Objects$;
(function (Objects$) {
    /** @deprecated use `Objects$inboundSchema` instead. */
    Objects$.inboundSchema = Objects$inboundSchema;
    /** @deprecated use `Objects$outboundSchema` instead. */
    Objects$.outboundSchema = Objects$outboundSchema;
})(Objects$ || (Objects$ = {}));
export function objectsToJSON(objects) {
    return JSON.stringify(Objects$outboundSchema.parse(objects));
}
export function objectsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Objects$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Objects' from JSON`);
}
/** @internal */
export const Bandwidth$inboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    used_percent: z.number().optional(),
}).transform((v) => {
    return remap$(v, {
        "used_percent": "usedPercent",
    });
});
/** @internal */
export const Bandwidth$outboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    usedPercent: z.number().optional(),
}).transform((v) => {
    return remap$(v, {
        usedPercent: "used_percent",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Bandwidth$;
(function (Bandwidth$) {
    /** @deprecated use `Bandwidth$inboundSchema` instead. */
    Bandwidth$.inboundSchema = Bandwidth$inboundSchema;
    /** @deprecated use `Bandwidth$outboundSchema` instead. */
    Bandwidth$.outboundSchema = Bandwidth$outboundSchema;
})(Bandwidth$ || (Bandwidth$ = {}));
export function bandwidthToJSON(bandwidth) {
    return JSON.stringify(Bandwidth$outboundSchema.parse(bandwidth));
}
export function bandwidthFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Bandwidth$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Bandwidth' from JSON`);
}
/** @internal */
export const Storage$inboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    used_percent: z.number().optional(),
}).transform((v) => {
    return remap$(v, {
        "used_percent": "usedPercent",
    });
});
/** @internal */
export const Storage$outboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    usedPercent: z.number().optional(),
}).transform((v) => {
    return remap$(v, {
        usedPercent: "used_percent",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Storage$;
(function (Storage$) {
    /** @deprecated use `Storage$inboundSchema` instead. */
    Storage$.inboundSchema = Storage$inboundSchema;
    /** @deprecated use `Storage$outboundSchema` instead. */
    Storage$.outboundSchema = Storage$outboundSchema;
})(Storage$ || (Storage$ = {}));
export function storageToJSON(storage) {
    return JSON.stringify(Storage$outboundSchema.parse(storage));
}
export function storageFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Storage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Storage' from JSON`);
}
/** @internal */
export const Impressions$inboundSchema = z.object({
    usage: z.number().int().optional(),
});
/** @internal */
export const Impressions$outboundSchema = z.object({
    usage: z.number().int().optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Impressions$;
(function (Impressions$) {
    /** @deprecated use `Impressions$inboundSchema` instead. */
    Impressions$.inboundSchema = Impressions$inboundSchema;
    /** @deprecated use `Impressions$outboundSchema` instead. */
    Impressions$.outboundSchema = Impressions$outboundSchema;
})(Impressions$ || (Impressions$ = {}));
export function impressionsToJSON(impressions) {
    return JSON.stringify(Impressions$outboundSchema.parse(impressions));
}
export function impressionsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Impressions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Impressions' from JSON`);
}
/** @internal */
export const SecondsDelivered$inboundSchema = z.object({
    usage: z.number().int().optional(),
});
/** @internal */
export const SecondsDelivered$outboundSchema = z.object({
    usage: z.number().int().optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var SecondsDelivered$;
(function (SecondsDelivered$) {
    /** @deprecated use `SecondsDelivered$inboundSchema` instead. */
    SecondsDelivered$.inboundSchema = SecondsDelivered$inboundSchema;
    /** @deprecated use `SecondsDelivered$outboundSchema` instead. */
    SecondsDelivered$.outboundSchema = SecondsDelivered$outboundSchema;
})(SecondsDelivered$ || (SecondsDelivered$ = {}));
export function secondsDeliveredToJSON(secondsDelivered) {
    return JSON.stringify(SecondsDelivered$outboundSchema.parse(secondsDelivered));
}
export function secondsDeliveredFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SecondsDelivered$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SecondsDelivered' from JSON`);
}
/** @internal */
export const MediaLimits$inboundSchema = z.object({
    image_max_size_bytes: z.number().int().optional(),
    video_max_size_bytes: z.number().int().optional(),
    raw_max_size_bytes: z.number().int().optional(),
    image_max_px: z.number().int().optional(),
    asset_max_total_px: z.number().int().optional(),
}).transform((v) => {
    return remap$(v, {
        "image_max_size_bytes": "imageMaxSizeBytes",
        "video_max_size_bytes": "videoMaxSizeBytes",
        "raw_max_size_bytes": "rawMaxSizeBytes",
        "image_max_px": "imageMaxPx",
        "asset_max_total_px": "assetMaxTotalPx",
    });
});
/** @internal */
export const MediaLimits$outboundSchema = z.object({
    imageMaxSizeBytes: z.number().int().optional(),
    videoMaxSizeBytes: z.number().int().optional(),
    rawMaxSizeBytes: z.number().int().optional(),
    imageMaxPx: z.number().int().optional(),
    assetMaxTotalPx: z.number().int().optional(),
}).transform((v) => {
    return remap$(v, {
        imageMaxSizeBytes: "image_max_size_bytes",
        videoMaxSizeBytes: "video_max_size_bytes",
        rawMaxSizeBytes: "raw_max_size_bytes",
        imageMaxPx: "image_max_px",
        assetMaxTotalPx: "asset_max_total_px",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var MediaLimits$;
(function (MediaLimits$) {
    /** @deprecated use `MediaLimits$inboundSchema` instead. */
    MediaLimits$.inboundSchema = MediaLimits$inboundSchema;
    /** @deprecated use `MediaLimits$outboundSchema` instead. */
    MediaLimits$.outboundSchema = MediaLimits$outboundSchema;
})(MediaLimits$ || (MediaLimits$ = {}));
export function mediaLimitsToJSON(mediaLimits) {
    return JSON.stringify(MediaLimits$outboundSchema.parse(mediaLimits));
}
export function mediaLimitsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => MediaLimits$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MediaLimits' from JSON`);
}
/** @internal */
export const UsageResponse$inboundSchema = z.object({
    plan: z.string().optional(),
    last_updated: z.string().transform(v => new RFCDate(v)).optional(),
    date_requested: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
    transformations: z.lazy(() => Transformations$inboundSchema).optional(),
    objects: z.lazy(() => Objects$inboundSchema).optional(),
    bandwidth: z.lazy(() => Bandwidth$inboundSchema).optional(),
    storage: z.lazy(() => Storage$inboundSchema).optional(),
    impressions: z.lazy(() => Impressions$inboundSchema).optional(),
    seconds_delivered: z.lazy(() => SecondsDelivered$inboundSchema).optional(),
    resources: z.number().int().optional(),
    derived_resources: z.number().int().optional(),
    requests: z.number().int().optional(),
    media_limits: z.lazy(() => MediaLimits$inboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        "last_updated": "lastUpdated",
        "date_requested": "dateRequested",
        "seconds_delivered": "secondsDelivered",
        "derived_resources": "derivedResources",
        "media_limits": "mediaLimits",
    });
});
/** @internal */
export const UsageResponse$outboundSchema = z.object({
    plan: z.string().optional(),
    lastUpdated: z.instanceof(RFCDate).transform(v => v.toString()).optional(),
    dateRequested: z.date().transform(v => v.toISOString()).optional(),
    transformations: z.lazy(() => Transformations$outboundSchema).optional(),
    objects: z.lazy(() => Objects$outboundSchema).optional(),
    bandwidth: z.lazy(() => Bandwidth$outboundSchema).optional(),
    storage: z.lazy(() => Storage$outboundSchema).optional(),
    impressions: z.lazy(() => Impressions$outboundSchema).optional(),
    secondsDelivered: z.lazy(() => SecondsDelivered$outboundSchema).optional(),
    resources: z.number().int().optional(),
    derivedResources: z.number().int().optional(),
    requests: z.number().int().optional(),
    mediaLimits: z.lazy(() => MediaLimits$outboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        lastUpdated: "last_updated",
        dateRequested: "date_requested",
        secondsDelivered: "seconds_delivered",
        derivedResources: "derived_resources",
        mediaLimits: "media_limits",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var UsageResponse$;
(function (UsageResponse$) {
    /** @deprecated use `UsageResponse$inboundSchema` instead. */
    UsageResponse$.inboundSchema = UsageResponse$inboundSchema;
    /** @deprecated use `UsageResponse$outboundSchema` instead. */
    UsageResponse$.outboundSchema = UsageResponse$outboundSchema;
})(UsageResponse$ || (UsageResponse$ = {}));
export function usageResponseToJSON(usageResponse) {
    return JSON.stringify(UsageResponse$outboundSchema.parse(usageResponse));
}
export function usageResponseFromJSON(jsonString) {
    return safeParse(jsonString, (x) => UsageResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UsageResponse' from JSON`);
}
//# sourceMappingURL=usageresponse.js.map