"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 LongRangeChannelMessages_exports = {};
__export(LongRangeChannelMessages_exports, {
  GetLongRangeChannelRequest: () => GetLongRangeChannelRequest,
  GetLongRangeChannelResponse: () => GetLongRangeChannelResponse,
  SetLongRangeChannelRequest: () => SetLongRangeChannelRequest,
  SetLongRangeChannelResponse: () => SetLongRangeChannelResponse
});
module.exports = __toCommonJS(LongRangeChannelMessages_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 GetLongRangeChannelRequest = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.GetLongRangeChannel), (0, import_serial.expectedResponse)(import_serial.FunctionType.GetLongRangeChannel), (0, import_serial.priority)(import_core.MessagePriority.Controller)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetLongRangeChannelRequest2 = class extends _classSuper {
    static {
      __name(this, "GetLongRangeChannelRequest");
    }
    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);
      GetLongRangeChannelRequest2 = _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 GetLongRangeChannelRequest2 = _classThis;
})();
let GetLongRangeChannelResponse = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Response, import_serial.FunctionType.GetLongRangeChannel), (0, import_serial.priority)(import_core.MessagePriority.Controller)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetLongRangeChannelResponse2 = class extends _classSuper {
    static {
      __name(this, "GetLongRangeChannelResponse");
    }
    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);
      GetLongRangeChannelResponse2 = _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.channel = options.channel;
      this.supportsAutoChannelSelection = options.supportsAutoChannelSelection;
      this.autoChannelSelectionActive = options.autoChannelSelectionActive;
    }
    static from(raw, _ctx) {
      const channel = raw.payload[0];
      let supportsAutoChannelSelection;
      let autoChannelSelectionActive;
      if (raw.payload.length >= 2) {
        supportsAutoChannelSelection = !!(raw.payload[1] & 16);
        autoChannelSelectionActive = !!(raw.payload[1] & 32);
      } else {
        supportsAutoChannelSelection = false;
        autoChannelSelectionActive = false;
      }
      return new this({
        channel,
        supportsAutoChannelSelection,
        autoChannelSelectionActive
      });
    }
    channel;
    supportsAutoChannelSelection;
    autoChannelSelectionActive;
  };
  return GetLongRangeChannelResponse2 = _classThis;
})();
let SetLongRangeChannelRequest = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.SetLongRangeChannel), (0, import_serial.priority)(import_core.MessagePriority.Controller), (0, import_serial.expectedResponse)(import_serial.FunctionType.SetLongRangeChannel)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var SetLongRangeChannelRequest2 = class extends _classSuper {
    static {
      __name(this, "SetLongRangeChannelRequest");
    }
    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);
      SetLongRangeChannelRequest2 = _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.channel = options.channel;
    }
    static from(_raw, _ctx) {
      throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
    }
    channel;
    serialize(ctx) {
      this.payload = import_shared.Bytes.from([this.channel]);
      return super.serialize(ctx);
    }
    toLogEntry() {
      return {
        ...super.toLogEntry(),
        message: {
          channel: (0, import_shared.getEnumMemberName)(import_core.LongRangeChannel, this.channel)
        }
      };
    }
  };
  return SetLongRangeChannelRequest2 = _classThis;
})();
let SetLongRangeChannelResponse = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Response, import_serial.FunctionType.SetLongRangeChannel)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var SetLongRangeChannelResponse2 = class extends _classSuper {
    static {
      __name(this, "SetLongRangeChannelResponse");
    }
    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);
      SetLongRangeChannelResponse2 = _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.success = options.success;
    }
    static from(raw, _ctx) {
      const success = raw.payload[0] !== 0;
      return new this({
        success
      });
    }
    isOK() {
      return this.success;
    }
    success;
    toLogEntry() {
      return {
        ...super.toLogEntry(),
        message: { success: this.success }
      };
    }
  };
  return SetLongRangeChannelResponse2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GetLongRangeChannelRequest,
  GetLongRangeChannelResponse,
  SetLongRangeChannelRequest,
  SetLongRangeChannelResponse
});
//# sourceMappingURL=LongRangeChannelMessages.js.map
