"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var GetBackgroundRSSIMessages_exports = {};
__export(GetBackgroundRSSIMessages_exports, {
  GetBackgroundRSSIRequest: () => GetBackgroundRSSIRequest,
  GetBackgroundRSSIResponse: () => GetBackgroundRSSIResponse
});
module.exports = __toCommonJS(GetBackgroundRSSIMessages_exports);
var import_tslib = require("tslib");
var import_core = require("@zwave-js/core");
var import_serial = require("@zwave-js/serial");
var import_SendDataShared = require("../transport/SendDataShared.js");
let GetBackgroundRSSIRequest = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.GetBackgroundRSSI), (0, import_serial.priority)(import_core.MessagePriority.Normal), (0, import_serial.expectedResponse)(import_serial.FunctionType.GetBackgroundRSSI)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetBackgroundRSSIRequest2 = class extends _classSuper {
    static {
      __name(this, "GetBackgroundRSSIRequest");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      GetBackgroundRSSIRequest2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
  };
  return GetBackgroundRSSIRequest2 = _classThis;
})();
let GetBackgroundRSSIResponse = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Response, import_serial.FunctionType.GetBackgroundRSSI)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetBackgroundRSSIResponse2 = class extends _classSuper {
    static {
      __name(this, "GetBackgroundRSSIResponse");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      GetBackgroundRSSIResponse2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.rssiChannel0 = options.rssiChannel0;
      this.rssiChannel1 = options.rssiChannel1;
      this.rssiChannel2 = options.rssiChannel2;
      this.rssiChannel3 = options.rssiChannel3;
    }
    static from(raw, _ctx) {
      const rssiChannel0 = (0, import_SendDataShared.parseRSSI)(raw.payload, 0);
      const rssiChannel1 = (0, import_SendDataShared.parseRSSI)(raw.payload, 1);
      const rssiChannel2 = (0, import_SendDataShared.tryParseRSSI)(raw.payload, 2);
      const rssiChannel3 = (0, import_SendDataShared.tryParseRSSI)(raw.payload, 3);
      return new this({
        rssiChannel0,
        rssiChannel1,
        rssiChannel2,
        rssiChannel3
      });
    }
    rssiChannel0;
    rssiChannel1;
    rssiChannel2;
    rssiChannel3;
    toLogEntry() {
      const message = {
        "channel 0": (0, import_core.rssiToString)(this.rssiChannel0),
        "channel 1": (0, import_core.rssiToString)(this.rssiChannel1)
      };
      if (this.rssiChannel2 != void 0) {
        message["channel 2"] = (0, import_core.rssiToString)(this.rssiChannel2);
      }
      if (this.rssiChannel3 != void 0) {
        message["channel 3"] = (0, import_core.rssiToString)(this.rssiChannel3);
      }
      return {
        ...super.toLogEntry(),
        message
      };
    }
  };
  return GetBackgroundRSSIResponse2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GetBackgroundRSSIRequest,
  GetBackgroundRSSIResponse
});
//# sourceMappingURL=GetBackgroundRSSIMessages.js.map
