"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.Accumulation$ = exports.Accumulation$outboundSchema = exports.Accumulation$inboundSchema = exports.Values$ = exports.Values$outboundSchema = exports.Values$inboundSchema = void 0;
exports.valuesToJSON = valuesToJSON;
exports.valuesFromJSON = valuesFromJSON;
exports.accumulationToJSON = accumulationToJSON;
exports.accumulationFromJSON = accumulationFromJSON;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const metricunit_js_1 = require("./metricunit.js");
const timeseriesinterval_js_1 = require("./timeseriesinterval.js");
/** @internal */
exports.Values$inboundSchema = z
    .union([z.number().int(), z.number()]);
/** @internal */
exports.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.
 */
var Values$;
(function (Values$) {
    /** @deprecated use `Values$inboundSchema` instead. */
    Values$.inboundSchema = exports.Values$inboundSchema;
    /** @deprecated use `Values$outboundSchema` instead. */
    Values$.outboundSchema = exports.Values$outboundSchema;
})(Values$ || (exports.Values$ = Values$ = {}));
function valuesToJSON(values) {
    return JSON.stringify(exports.Values$outboundSchema.parse(values));
}
function valuesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Values$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Values' from JSON`);
}
/** @internal */
exports.Accumulation$inboundSchema = z.object({
    bucket_length: timeseriesinterval_js_1.TimeseriesInterval$inboundSchema,
    name: z.string(),
    unit: metricunit_js_1.MetricUnit$inboundSchema,
    values: z.array(z.array(z.union([z.number().int(), z.number()]))),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "bucket_length": "bucketLength",
    });
});
/** @internal */
exports.Accumulation$outboundSchema = z.object({
    bucketLength: timeseriesinterval_js_1.TimeseriesInterval$outboundSchema,
    name: z.string(),
    unit: metricunit_js_1.MetricUnit$outboundSchema,
    values: z.array(z.array(z.union([z.number().int(), z.number()]))),
}).transform((v) => {
    return (0, primitives_js_1.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.
 */
var Accumulation$;
(function (Accumulation$) {
    /** @deprecated use `Accumulation$inboundSchema` instead. */
    Accumulation$.inboundSchema = exports.Accumulation$inboundSchema;
    /** @deprecated use `Accumulation$outboundSchema` instead. */
    Accumulation$.outboundSchema = exports.Accumulation$outboundSchema;
})(Accumulation$ || (exports.Accumulation$ = Accumulation$ = {}));
function accumulationToJSON(accumulation) {
    return JSON.stringify(exports.Accumulation$outboundSchema.parse(accumulation));
}
function accumulationFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Accumulation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Accumulation' from JSON`);
}
//# sourceMappingURL=accumulation.js.map