"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 GetNVMIdMessages_exports = {};
__export(GetNVMIdMessages_exports, {
  GetNVMIdRequest: () => GetNVMIdRequest,
  GetNVMIdResponse: () => GetNVMIdResponse,
  NVMSize: () => NVMSize,
  NVMType: () => NVMType,
  nvmSizeToBufferSize: () => nvmSizeToBufferSize
});
module.exports = __toCommonJS(GetNVMIdMessages_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");
var NVMType;
(function(NVMType2) {
  NVMType2[NVMType2["Flash"] = 128] = "Flash";
  NVMType2[NVMType2["DataFlash"] = 129] = "DataFlash";
  NVMType2[NVMType2["EEPROM"] = 255] = "EEPROM";
})(NVMType || (NVMType = {}));
var NVMSize;
(function(NVMSize2) {
  NVMSize2[NVMSize2["16KB"] = 14] = "16KB";
  NVMSize2[NVMSize2["32KB"] = 15] = "32KB";
  NVMSize2[NVMSize2["64KB"] = 16] = "64KB";
  NVMSize2[NVMSize2["128KB"] = 17] = "128KB";
  NVMSize2[NVMSize2["256KB"] = 18] = "256KB";
  NVMSize2[NVMSize2["512KB"] = 19] = "512KB";
  NVMSize2[NVMSize2["1MB"] = 20] = "1MB";
  NVMSize2[NVMSize2["2MB"] = 21] = "2MB";
  NVMSize2[NVMSize2["4MB"] = 22] = "4MB";
  NVMSize2[NVMSize2["8MB"] = 23] = "8MB";
  NVMSize2[NVMSize2["16MB"] = 24] = "16MB";
  NVMSize2[NVMSize2["Unknown"] = 255] = "Unknown";
})(NVMSize || (NVMSize = {}));
function nvmSizeToBufferSize(size) {
  switch (size) {
    case NVMSize["16KB"]:
      return 16 * 1024;
    case NVMSize["32KB"]:
      return 32 * 1024;
    case NVMSize["64KB"]:
      return 64 * 1024;
    case NVMSize["128KB"]:
      return 128 * 1024;
    case NVMSize["256KB"]:
      return 256 * 1024;
    case NVMSize["512KB"]:
      return 512 * 1024;
    case NVMSize["1MB"]:
      return 1 * 1024 * 1024;
    case NVMSize["2MB"]:
      return 2 * 1024 * 1024;
    case NVMSize["4MB"]:
      return 4 * 1024 * 1024;
    case NVMSize["8MB"]:
      return 8 * 1024 * 1024;
    case NVMSize["16MB"]:
      return 16 * 1024 * 1024;
    default:
      return void 0;
  }
}
__name(nvmSizeToBufferSize, "nvmSizeToBufferSize");
let GetNVMIdRequest = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.GetNVMId), (0, import_serial.expectedResponse)(import_serial.FunctionType.GetNVMId), (0, import_serial.priority)(import_core.MessagePriority.Controller)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetNVMIdRequest2 = class extends _classSuper {
    static {
      __name(this, "GetNVMIdRequest");
    }
    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);
      GetNVMIdRequest2 = _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 GetNVMIdRequest2 = _classThis;
})();
let GetNVMIdResponse = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Response, import_serial.FunctionType.GetNVMId)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetNVMIdResponse2 = class extends _classSuper {
    static {
      __name(this, "GetNVMIdResponse");
    }
    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);
      GetNVMIdResponse2 = _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.nvmManufacturerId = options.nvmManufacturerId;
      this.memoryType = options.memoryType;
      this.memorySize = options.memorySize;
    }
    static from(raw, _ctx) {
      const nvmManufacturerId = raw.payload[1];
      const memoryType = raw.payload[2];
      const memorySize = raw.payload[3];
      return new this({
        nvmManufacturerId,
        memoryType,
        memorySize
      });
    }
    nvmManufacturerId;
    memoryType;
    memorySize;
    toLogEntry() {
      return {
        ...super.toLogEntry(),
        message: {
          manufacturer: (0, import_shared.num2hex)(this.nvmManufacturerId),
          "memory type": (0, import_shared.getEnumMemberName)(NVMType, this.memoryType),
          "memory size": (0, import_shared.getEnumMemberName)(NVMSize, this.memorySize)
        }
      };
    }
  };
  return GetNVMIdResponse2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GetNVMIdRequest,
  GetNVMIdResponse,
  NVMSize,
  NVMType,
  nvmSizeToBufferSize
});
//# sourceMappingURL=GetNVMIdMessages.js.map
