"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var byte_buffer_1 = require("../../core/buffer/byte-buffer");
var model_converters_1 = require("../converter/model-converters");
var PROTOCOL_CONF_CTR_LENGHT = 8;
var ReversedProtocolConfigurationConverter = /** @class */ (function () {
    function ReversedProtocolConfigurationConverter() {
        this.converter = new model_converters_1.ProtocolConfigurationConverter();
    }
    ReversedProtocolConfigurationConverter.prototype.decode = function (data) {
        return this.converter.decode(this._reorderBytes(data));
    };
    ReversedProtocolConfigurationConverter.prototype.encode = function (settings) {
        return this._reorderBytes(this.converter.encode(settings));
    };
    ReversedProtocolConfigurationConverter.prototype._reorderBytes = function (data) {
        return byte_buffer_1.ByteBuffer.merge(data.slice(0, PROTOCOL_CONF_CTR_LENGHT).reverse(), data.slice(PROTOCOL_CONF_CTR_LENGHT)).data;
    };
    return ReversedProtocolConfigurationConverter;
}());
exports.ReversedProtocolConfigurationConverter = ReversedProtocolConfigurationConverter;
