/*
 * 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 { MetricUnit$inboundSchema, MetricUnit$outboundSchema, } from "./metricunit.js";
import { TimeseriesInterval$inboundSchema, TimeseriesInterval$outboundSchema, } from "./timeseriesinterval.js";
/** @internal */
export const Values$inboundSchema = z
    .union([z.number().int(), z.number()]);
/** @internal */
export const Values$outboundSchema = z.union([z.number().int(), z.number()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Values$;
(function (Values$) {
    /** @deprecated use `Values$inboundSchema` instead. */
    Values$.inboundSchema = Values$inboundSchema;
    /** @deprecated use `Values$outboundSchema` instead. */
    Values$.outboundSchema = Values$outboundSchema;
})(Values$ || (Values$ = {}));
export function valuesToJSON(values) {
    return JSON.stringify(Values$outboundSchema.parse(values));
}
export function valuesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Values$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Values' from JSON`);
}
/** @internal */
export const Accumulation$inboundSchema = z.object({
    bucket_length: TimeseriesInterval$inboundSchema,
    name: z.string(),
    unit: MetricUnit$inboundSchema,
    values: z.array(z.array(z.union([z.number().int(), z.number()]))),
}).transform((v) => {
    return remap$(v, {
        "bucket_length": "bucketLength",
    });
});
/** @internal */
export const Accumulation$outboundSchema = z.object({
    bucketLength: TimeseriesInterval$outboundSchema,
    name: z.string(),
    unit: MetricUnit$outboundSchema,
    values: z.array(z.array(z.union([z.number().int(), z.number()]))),
}).transform((v) => {
    return remap$(v, {
        bucketLength: "bucket_length",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Accumulation$;
(function (Accumulation$) {
    /** @deprecated use `Accumulation$inboundSchema` instead. */
    Accumulation$.inboundSchema = Accumulation$inboundSchema;
    /** @deprecated use `Accumulation$outboundSchema` instead. */
    Accumulation$.outboundSchema = Accumulation$outboundSchema;
})(Accumulation$ || (Accumulation$ = {}));
export function accumulationToJSON(accumulation) {
    return JSON.stringify(Accumulation$outboundSchema.parse(accumulation));
}
export function accumulationFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Accumulation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Accumulation' from JSON`);
}
//# sourceMappingURL=accumulation.js.map