"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 DeleteReturnRouteMessages_exports = {};
__export(DeleteReturnRouteMessages_exports, {
  DeleteReturnRouteRequest: () => DeleteReturnRouteRequest,
  DeleteReturnRouteRequestBase: () => DeleteReturnRouteRequestBase,
  DeleteReturnRouteRequestTransmitReport: () => DeleteReturnRouteRequestTransmitReport,
  DeleteReturnRouteResponse: () => DeleteReturnRouteResponse
});
module.exports = __toCommonJS(DeleteReturnRouteMessages_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 DeleteReturnRouteRequestBase = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.DeleteReturnRoute), (0, import_serial.priority)(import_core.MessagePriority.Normal)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var DeleteReturnRouteRequestBase2 = class extends _classSuper {
    static {
      __name(this, "DeleteReturnRouteRequestBase");
    }
    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);
      DeleteReturnRouteRequestBase2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    static from(raw, ctx) {
      if (ctx.origin === import_serial.MessageOrigin.Host) {
        return DeleteReturnRouteRequest.from(raw, ctx);
      } else {
        return DeleteReturnRouteRequestTransmitReport.from(raw, ctx);
      }
    }
  };
  return DeleteReturnRouteRequestBase2 = _classThis;
})();
let DeleteReturnRouteRequest = (() => {
  let _classDecorators = [(0, import_serial.expectedResponse)(import_serial.FunctionType.DeleteReturnRoute), (0, import_serial.expectedCallback)(import_serial.FunctionType.DeleteReturnRoute)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = DeleteReturnRouteRequestBase;
  var DeleteReturnRouteRequest2 = class extends _classSuper {
    static {
      __name(this, "DeleteReturnRouteRequest");
    }
    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);
      DeleteReturnRouteRequest2 = _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.nodeId = options.nodeId;
    }
    static from(_raw, _ctx) {
      throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
    }
    nodeId;
    serialize(ctx) {
      this.assertCallbackId();
      const nodeId = (0, import_core.encodeNodeID)(this.nodeId, ctx.nodeIdType);
      this.payload = import_shared.Bytes.concat([nodeId, [this.callbackId]]);
      return super.serialize(ctx);
    }
  };
  return DeleteReturnRouteRequest2 = _classThis;
})();
let DeleteReturnRouteResponse = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Response, import_serial.FunctionType.DeleteReturnRoute)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var DeleteReturnRouteResponse2 = class extends _classSuper {
    static {
      __name(this, "DeleteReturnRouteResponse");
    }
    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);
      DeleteReturnRouteResponse2 = _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.hasStarted = options.hasStarted;
    }
    static from(raw, _ctx) {
      const hasStarted = raw.payload[0] !== 0;
      return new this({
        hasStarted
      });
    }
    isOK() {
      return this.hasStarted;
    }
    hasStarted;
    toLogEntry() {
      return {
        ...super.toLogEntry(),
        message: { "has started": this.hasStarted }
      };
    }
  };
  return DeleteReturnRouteResponse2 = _classThis;
})();
class DeleteReturnRouteRequestTransmitReport extends DeleteReturnRouteRequestBase {
  static {
    __name(this, "DeleteReturnRouteRequestTransmitReport");
  }
  constructor(options) {
    super(options);
    this.callbackId = options.callbackId;
    this.transmitStatus = options.transmitStatus;
  }
  static from(raw, _ctx) {
    const callbackId = raw.payload[0];
    const transmitStatus = raw.payload[1];
    return new this({
      callbackId,
      transmitStatus
    });
  }
  isOK() {
    return this.transmitStatus !== import_core.TransmitStatus.NoAck;
  }
  transmitStatus;
  toLogEntry() {
    return {
      ...super.toLogEntry(),
      message: {
        "callback id": this.callbackId ?? "(not set)",
        "transmit status": (0, import_shared.getEnumMemberName)(import_core.TransmitStatus, this.transmitStatus)
      }
    };
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  DeleteReturnRouteRequest,
  DeleteReturnRouteRequestBase,
  DeleteReturnRouteRequestTransmitReport,
  DeleteReturnRouteResponse
});
//# sourceMappingURL=DeleteReturnRouteMessages.js.map
