"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var variable_service_1 = require("./gen/variable-service");
var impl_1 = require("../../client/impl");
var core_1 = require("../../core");
var TlvBundleConverter_1 = require("../extra-converter/TlvBundleConverter");
// declare module "./gen/bundle-service" {
//     export interface BundleService {
//         getVariablesId(): 
//     }
// }
variable_service_1.VariableService.prototype.getMetaData = function (id) {
    return this.getName(id).then(function (responseInterface) {
        // TODO check type
        var response = responseInterface;
        if (response.isSuccessful()) {
            var data = core_1.FormatHelper.toByteBuffer(response.body());
            response.setBody(data);
        }
        return response;
    });
};
variable_service_1.VariableService.prototype.putMetaData = function (id, data) {
    var dataString = new impl_1.StringConverter("utf8").decode(data);
    return this.putName(id, dataString);
};
variable_service_1.VariableService.prototype.getAllValues = function () {
    return this.readProfile().then(function (responseInterface) {
        var response = responseInterface;
        if (response.isSuccessful()) {
            var data = response.rawBody();
            var converter = new TlvBundleConverter_1.TlvBundleConverter();
            var mappings = converter.decode(data);
            response.setBody(mappings);
        }
        return response;
    });
};
