"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 ExtNVMReadLongBufferMessages_exports = {};
__export(ExtNVMReadLongBufferMessages_exports, {
  ExtNVMReadLongBufferRequest: () => ExtNVMReadLongBufferRequest,
  ExtNVMReadLongBufferResponse: () => ExtNVMReadLongBufferResponse
});
module.exports = __toCommonJS(ExtNVMReadLongBufferMessages_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 ExtNVMReadLongBufferRequest = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.ExtNVMReadLongBuffer), (0, import_serial.priority)(import_core.MessagePriority.Controller), (0, import_serial.expectedResponse)(import_serial.FunctionType.ExtNVMReadLongBuffer)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var ExtNVMReadLongBufferRequest2 = class extends _classSuper {
    static {
      __name(this, "ExtNVMReadLongBufferRequest");
    }
    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);
      ExtNVMReadLongBufferRequest2 = _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);
      if (options.offset < 0 || options.offset > 16777215) {
        throw new import_core.ZWaveError("The offset must be a 24-bit number!", import_core.ZWaveErrorCodes.Argument_Invalid);
      }
      if (options.length < 1 || options.length > 65535) {
        throw new import_core.ZWaveError("The length must be between 1 and 65535", import_core.ZWaveErrorCodes.Argument_Invalid);
      }
      this.offset = options.offset;
      this.length = options.length;
    }
    static from(_raw, _ctx) {
      throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
    }
    offset;
    length;
    serialize(ctx) {
      this.payload = new import_shared.Bytes(5);
      this.payload.writeUIntBE(this.offset, 0, 3);
      this.payload.writeUInt16BE(this.length, 3);
      return super.serialize(ctx);
    }
    toLogEntry() {
      return {
        ...super.toLogEntry(),
        message: {
          offset: (0, import_shared.num2hex)(this.offset),
          length: this.length
        }
      };
    }
  };
  return ExtNVMReadLongBufferRequest2 = _classThis;
})();
let ExtNVMReadLongBufferResponse = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Response, import_serial.FunctionType.ExtNVMReadLongBuffer)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var ExtNVMReadLongBufferResponse2 = class extends _classSuper {
    static {
      __name(this, "ExtNVMReadLongBufferResponse");
    }
    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);
      ExtNVMReadLongBufferResponse2 = _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.buffer = options.buffer;
    }
    static from(raw, _ctx) {
      return new this({
        buffer: raw.payload
      });
    }
    buffer;
    toLogEntry() {
      return {
        ...super.toLogEntry(),
        message: {
          buffer: `(${this.buffer.length} byte${this.buffer.length === 1 ? "" : "s"})`
        }
      };
    }
  };
  return ExtNVMReadLongBufferResponse2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ExtNVMReadLongBufferRequest,
  ExtNVMReadLongBufferResponse
});
//# sourceMappingURL=ExtNVMReadLongBufferMessages.js.map
