"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.UsageResponse$ = exports.UsageResponse$outboundSchema = exports.UsageResponse$inboundSchema = exports.MediaLimits$ = exports.MediaLimits$outboundSchema = exports.MediaLimits$inboundSchema = exports.SecondsDelivered$ = exports.SecondsDelivered$outboundSchema = exports.SecondsDelivered$inboundSchema = exports.Impressions$ = exports.Impressions$outboundSchema = exports.Impressions$inboundSchema = exports.Storage$ = exports.Storage$outboundSchema = exports.Storage$inboundSchema = exports.Bandwidth$ = exports.Bandwidth$outboundSchema = exports.Bandwidth$inboundSchema = exports.Objects$ = exports.Objects$outboundSchema = exports.Objects$inboundSchema = exports.Transformations$ = exports.Transformations$outboundSchema = exports.Transformations$inboundSchema = void 0;
exports.transformationsToJSON = transformationsToJSON;
exports.transformationsFromJSON = transformationsFromJSON;
exports.objectsToJSON = objectsToJSON;
exports.objectsFromJSON = objectsFromJSON;
exports.bandwidthToJSON = bandwidthToJSON;
exports.bandwidthFromJSON = bandwidthFromJSON;
exports.storageToJSON = storageToJSON;
exports.storageFromJSON = storageFromJSON;
exports.impressionsToJSON = impressionsToJSON;
exports.impressionsFromJSON = impressionsFromJSON;
exports.secondsDeliveredToJSON = secondsDeliveredToJSON;
exports.secondsDeliveredFromJSON = secondsDeliveredFromJSON;
exports.mediaLimitsToJSON = mediaLimitsToJSON;
exports.mediaLimitsFromJSON = mediaLimitsFromJSON;
exports.usageResponseToJSON = usageResponseToJSON;
exports.usageResponseFromJSON = usageResponseFromJSON;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const rfcdate_js_1 = require("../../types/rfcdate.js");
/** @internal */
exports.Transformations$inboundSchema = z.object({
    usage: z.number().int().optional(),
});
/** @internal */
exports.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.
 */
var Transformations$;
(function (Transformations$) {
    /** @deprecated use `Transformations$inboundSchema` instead. */
    Transformations$.inboundSchema = exports.Transformations$inboundSchema;
    /** @deprecated use `Transformations$outboundSchema` instead. */
    Transformations$.outboundSchema = exports.Transformations$outboundSchema;
})(Transformations$ || (exports.Transformations$ = Transformations$ = {}));
function transformationsToJSON(transformations) {
    return JSON.stringify(exports.Transformations$outboundSchema.parse(transformations));
}
function transformationsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Transformations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Transformations' from JSON`);
}
/** @internal */
exports.Objects$inboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    used_percent: z.number().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "used_percent": "usedPercent",
    });
});
/** @internal */
exports.Objects$outboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    usedPercent: z.number().optional(),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var Objects$;
(function (Objects$) {
    /** @deprecated use `Objects$inboundSchema` instead. */
    Objects$.inboundSchema = exports.Objects$inboundSchema;
    /** @deprecated use `Objects$outboundSchema` instead. */
    Objects$.outboundSchema = exports.Objects$outboundSchema;
})(Objects$ || (exports.Objects$ = Objects$ = {}));
function objectsToJSON(objects) {
    return JSON.stringify(exports.Objects$outboundSchema.parse(objects));
}
function objectsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Objects$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Objects' from JSON`);
}
/** @internal */
exports.Bandwidth$inboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    used_percent: z.number().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "used_percent": "usedPercent",
    });
});
/** @internal */
exports.Bandwidth$outboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    usedPercent: z.number().optional(),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var Bandwidth$;
(function (Bandwidth$) {
    /** @deprecated use `Bandwidth$inboundSchema` instead. */
    Bandwidth$.inboundSchema = exports.Bandwidth$inboundSchema;
    /** @deprecated use `Bandwidth$outboundSchema` instead. */
    Bandwidth$.outboundSchema = exports.Bandwidth$outboundSchema;
})(Bandwidth$ || (exports.Bandwidth$ = Bandwidth$ = {}));
function bandwidthToJSON(bandwidth) {
    return JSON.stringify(exports.Bandwidth$outboundSchema.parse(bandwidth));
}
function bandwidthFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Bandwidth$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Bandwidth' from JSON`);
}
/** @internal */
exports.Storage$inboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    used_percent: z.number().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "used_percent": "usedPercent",
    });
});
/** @internal */
exports.Storage$outboundSchema = z.object({
    usage: z.number().int().optional(),
    limit: z.number().int().optional(),
    usedPercent: z.number().optional(),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var Storage$;
(function (Storage$) {
    /** @deprecated use `Storage$inboundSchema` instead. */
    Storage$.inboundSchema = exports.Storage$inboundSchema;
    /** @deprecated use `Storage$outboundSchema` instead. */
    Storage$.outboundSchema = exports.Storage$outboundSchema;
})(Storage$ || (exports.Storage$ = Storage$ = {}));
function storageToJSON(storage) {
    return JSON.stringify(exports.Storage$outboundSchema.parse(storage));
}
function storageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Storage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Storage' from JSON`);
}
/** @internal */
exports.Impressions$inboundSchema = z.object({
    usage: z.number().int().optional(),
});
/** @internal */
exports.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.
 */
var Impressions$;
(function (Impressions$) {
    /** @deprecated use `Impressions$inboundSchema` instead. */
    Impressions$.inboundSchema = exports.Impressions$inboundSchema;
    /** @deprecated use `Impressions$outboundSchema` instead. */
    Impressions$.outboundSchema = exports.Impressions$outboundSchema;
})(Impressions$ || (exports.Impressions$ = Impressions$ = {}));
function impressionsToJSON(impressions) {
    return JSON.stringify(exports.Impressions$outboundSchema.parse(impressions));
}
function impressionsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Impressions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Impressions' from JSON`);
}
/** @internal */
exports.SecondsDelivered$inboundSchema = z.object({
    usage: z.number().int().optional(),
});
/** @internal */
exports.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.
 */
var SecondsDelivered$;
(function (SecondsDelivered$) {
    /** @deprecated use `SecondsDelivered$inboundSchema` instead. */
    SecondsDelivered$.inboundSchema = exports.SecondsDelivered$inboundSchema;
    /** @deprecated use `SecondsDelivered$outboundSchema` instead. */
    SecondsDelivered$.outboundSchema = exports.SecondsDelivered$outboundSchema;
})(SecondsDelivered$ || (exports.SecondsDelivered$ = SecondsDelivered$ = {}));
function secondsDeliveredToJSON(secondsDelivered) {
    return JSON.stringify(exports.SecondsDelivered$outboundSchema.parse(secondsDelivered));
}
function secondsDeliveredFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.SecondsDelivered$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SecondsDelivered' from JSON`);
}
/** @internal */
exports.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 (0, primitives_js_1.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 */
exports.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 (0, primitives_js_1.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.
 */
var MediaLimits$;
(function (MediaLimits$) {
    /** @deprecated use `MediaLimits$inboundSchema` instead. */
    MediaLimits$.inboundSchema = exports.MediaLimits$inboundSchema;
    /** @deprecated use `MediaLimits$outboundSchema` instead. */
    MediaLimits$.outboundSchema = exports.MediaLimits$outboundSchema;
})(MediaLimits$ || (exports.MediaLimits$ = MediaLimits$ = {}));
function mediaLimitsToJSON(mediaLimits) {
    return JSON.stringify(exports.MediaLimits$outboundSchema.parse(mediaLimits));
}
function mediaLimitsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.MediaLimits$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MediaLimits' from JSON`);
}
/** @internal */
exports.UsageResponse$inboundSchema = z.object({
    plan: z.string().optional(),
    last_updated: z.string().transform(v => new rfcdate_js_1.RFCDate(v)).optional(),
    date_requested: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
    transformations: z.lazy(() => exports.Transformations$inboundSchema).optional(),
    objects: z.lazy(() => exports.Objects$inboundSchema).optional(),
    bandwidth: z.lazy(() => exports.Bandwidth$inboundSchema).optional(),
    storage: z.lazy(() => exports.Storage$inboundSchema).optional(),
    impressions: z.lazy(() => exports.Impressions$inboundSchema).optional(),
    seconds_delivered: z.lazy(() => exports.SecondsDelivered$inboundSchema).optional(),
    resources: z.number().int().optional(),
    derived_resources: z.number().int().optional(),
    requests: z.number().int().optional(),
    media_limits: z.lazy(() => exports.MediaLimits$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "last_updated": "lastUpdated",
        "date_requested": "dateRequested",
        "seconds_delivered": "secondsDelivered",
        "derived_resources": "derivedResources",
        "media_limits": "mediaLimits",
    });
});
/** @internal */
exports.UsageResponse$outboundSchema = z.object({
    plan: z.string().optional(),
    lastUpdated: z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString()).optional(),
    dateRequested: z.date().transform(v => v.toISOString()).optional(),
    transformations: z.lazy(() => exports.Transformations$outboundSchema).optional(),
    objects: z.lazy(() => exports.Objects$outboundSchema).optional(),
    bandwidth: z.lazy(() => exports.Bandwidth$outboundSchema).optional(),
    storage: z.lazy(() => exports.Storage$outboundSchema).optional(),
    impressions: z.lazy(() => exports.Impressions$outboundSchema).optional(),
    secondsDelivered: z.lazy(() => exports.SecondsDelivered$outboundSchema).optional(),
    resources: z.number().int().optional(),
    derivedResources: z.number().int().optional(),
    requests: z.number().int().optional(),
    mediaLimits: z.lazy(() => exports.MediaLimits$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var UsageResponse$;
(function (UsageResponse$) {
    /** @deprecated use `UsageResponse$inboundSchema` instead. */
    UsageResponse$.inboundSchema = exports.UsageResponse$inboundSchema;
    /** @deprecated use `UsageResponse$outboundSchema` instead. */
    UsageResponse$.outboundSchema = exports.UsageResponse$outboundSchema;
})(UsageResponse$ || (exports.UsageResponse$ = UsageResponse$ = {}));
function usageResponseToJSON(usageResponse) {
    return JSON.stringify(exports.UsageResponse$outboundSchema.parse(usageResponse));
}
function usageResponseFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UsageResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UsageResponse' from JSON`);
}
//# sourceMappingURL=usageresponse.js.map