"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 GetControllerCapabilitiesMessages_exports = {};
__export(GetControllerCapabilitiesMessages_exports, {
  GetControllerCapabilitiesRequest: () => GetControllerCapabilitiesRequest,
  GetControllerCapabilitiesResponse: () => GetControllerCapabilitiesResponse
});
module.exports = __toCommonJS(GetControllerCapabilitiesMessages_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 GetControllerCapabilitiesRequest = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Request, import_serial.FunctionType.GetControllerCapabilities), (0, import_serial.expectedResponse)(import_serial.FunctionType.GetControllerCapabilities), (0, import_serial.priority)(import_core.MessagePriority.Controller)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetControllerCapabilitiesRequest2 = class extends _classSuper {
    static {
      __name(this, "GetControllerCapabilitiesRequest");
    }
    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);
      GetControllerCapabilitiesRequest2 = _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 GetControllerCapabilitiesRequest2 = _classThis;
})();
let GetControllerCapabilitiesResponse = (() => {
  let _classDecorators = [(0, import_serial.messageTypes)(import_serial.MessageType.Response, import_serial.FunctionType.GetControllerCapabilities)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_serial.Message;
  var GetControllerCapabilitiesResponse2 = class extends _classSuper {
    static {
      __name(this, "GetControllerCapabilitiesResponse");
    }
    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);
      GetControllerCapabilitiesResponse2 = _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.isSecondary = options.isSecondary;
      this.isUsingHomeIdFromOtherNetwork = options.isUsingHomeIdFromOtherNetwork;
      this.isSISPresent = options.isSISPresent;
      this.wasRealPrimary = options.wasRealPrimary;
      this.isStaticUpdateController = options.isStaticUpdateController;
      this.noNodesIncluded = options.noNodesIncluded;
    }
    static from(raw, _ctx) {
      const capabilityFlags = raw.payload[0];
      const isSecondary = !!(capabilityFlags & import_core.ControllerCapabilityFlags.Secondary);
      const isUsingHomeIdFromOtherNetwork = !!(capabilityFlags & import_core.ControllerCapabilityFlags.OnOtherNetwork);
      const isSISPresent = !!(capabilityFlags & import_core.ControllerCapabilityFlags.SISPresent);
      const wasRealPrimary = !!(capabilityFlags & import_core.ControllerCapabilityFlags.WasRealPrimary);
      const isStaticUpdateController = !!(capabilityFlags & import_core.ControllerCapabilityFlags.SUC);
      const noNodesIncluded = !!(capabilityFlags & import_core.ControllerCapabilityFlags.NoNodesIncluded);
      return new this({
        isSecondary,
        isUsingHomeIdFromOtherNetwork,
        isSISPresent,
        wasRealPrimary,
        isStaticUpdateController,
        noNodesIncluded
      });
    }
    isSecondary;
    isUsingHomeIdFromOtherNetwork;
    isSISPresent;
    wasRealPrimary;
    isStaticUpdateController;
    noNodesIncluded;
    serialize(ctx) {
      this.payload = import_shared.Bytes.from([
        (this.isSecondary ? import_core.ControllerCapabilityFlags.Secondary : 0) | (this.isUsingHomeIdFromOtherNetwork ? import_core.ControllerCapabilityFlags.OnOtherNetwork : 0) | (this.isSISPresent ? import_core.ControllerCapabilityFlags.SISPresent : 0) | (this.wasRealPrimary ? import_core.ControllerCapabilityFlags.WasRealPrimary : 0) | (this.isStaticUpdateController ? import_core.ControllerCapabilityFlags.SUC : 0) | (this.noNodesIncluded ? import_core.ControllerCapabilityFlags.NoNodesIncluded : 0)
      ]);
      return super.serialize(ctx);
    }
  };
  return GetControllerCapabilitiesResponse2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GetControllerCapabilitiesRequest,
  GetControllerCapabilitiesResponse
});
//# sourceMappingURL=GetControllerCapabilitiesMessages.js.map
