"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 SetApplicationNodeInformationRequest_exports = {};
__export(SetApplicationNodeInformationRequest_exports, {
  SetApplicationNodeInformationRequest: () => SetApplicationNodeInformationRequest
});
module.exports = __toCommonJS(SetApplicationNodeInformationRequest_exports);
var import_tslib = require("tslib");
var import_core = require("@zwave-js/core");
var import_serial = require("@zwave-js/serial");
var import_shared = require("@zwave-js/shared");
let SetApplicationNodeInformationRequest = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.SetApplicationNodeInformation), (0, import_serial.priority)(import_core.MessagePriority.Controller)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var SetApplicationNodeInformationRequest2 = class extends _classSuper {
    static {
      __name(this, "SetApplicationNodeInformationRequest");
    }
    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);
      SetApplicationNodeInformationRequest2 = _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.isListening = options.isListening;
      this.genericDeviceClass = options.genericDeviceClass;
      this.specificDeviceClass = options.specificDeviceClass;
      this.supportedCCs = options.supportedCCs;
      this.controlledCCs = options.controlledCCs;
    }
    isListening;
    genericDeviceClass;
    specificDeviceClass;
    supportedCCs;
    controlledCCs;
    serialize(ctx) {
      const ccList = (0, import_core.encodeCCList)(this.supportedCCs, this.controlledCCs);
      const ccListLength = Math.min(ccList.length, 35);
      this.payload = import_shared.Bytes.from([
        this.isListening ? 1 : 0,
        // APPLICATION_NODEINFO_LISTENING
        this.genericDeviceClass,
        this.specificDeviceClass,
        ccListLength,
        ...ccList.subarray(0, ccListLength)
      ]);
      return super.serialize(ctx);
    }
    toLogEntry() {
      return {
        ...super.toLogEntry(),
        message: {
          "is listening": this.isListening,
          "generic device class": (0, import_shared.num2hex)(this.genericDeviceClass),
          "specific device class": (0, import_shared.num2hex)(this.specificDeviceClass),
          "supported CCs": (0, import_core.logList)(this.supportedCCs.map((cc) => (0, import_core.getCCName)(cc))),
          "controlled CCs": (0, import_core.logList)(this.controlledCCs.map((cc) => (0, import_core.getCCName)(cc)))
        }
      };
    }
  };
  return SetApplicationNodeInformationRequest2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  SetApplicationNodeInformationRequest
});
//# sourceMappingURL=SetApplicationNodeInformationRequest.js.map
