"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 ApplicationTypeFile_exports = {};
__export(ApplicationTypeFile_exports, {
  ApplicationTypeFile: () => ApplicationTypeFile,
  ApplicationTypeFileID: () => ApplicationTypeFileID
});
module.exports = __toCommonJS(ApplicationTypeFile_exports);
var import_tslib = require("tslib");
var import_shared = require("@zwave-js/shared");
var import_NVMFile = require("./NVMFile.js");
const ApplicationTypeFileID = 102;
let ApplicationTypeFile = (() => {
  let _classDecorators = [(0, import_NVMFile.nvmFileID)(ApplicationTypeFileID), (0, import_NVMFile.nvmSection)("application")];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_NVMFile.NVMFile;
  var ApplicationTypeFile2 = class extends _classSuper {
    static {
      __name(this, "ApplicationTypeFile");
    }
    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);
      ApplicationTypeFile2 = _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 ((0, import_NVMFile.gotDeserializationOptions)(options)) {
        this.isListening = !!(this.payload[0] & 1);
        this.optionalFunctionality = !!(this.payload[0] & 2);
        this.genericDeviceClass = this.payload[1];
        this.specificDeviceClass = this.payload[2];
      } else {
        this.isListening = options.isListening;
        this.optionalFunctionality = options.optionalFunctionality;
        this.genericDeviceClass = options.genericDeviceClass;
        this.specificDeviceClass = options.specificDeviceClass;
      }
    }
    isListening;
    optionalFunctionality;
    genericDeviceClass;
    specificDeviceClass;
    serialize() {
      this.payload = import_shared.Bytes.from([
        (this.isListening ? 1 : 0) | (this.optionalFunctionality ? 2 : 0),
        this.genericDeviceClass,
        this.specificDeviceClass
      ]);
      return super.serialize();
    }
    // oxlint-disable-next-line typescript/explicit-module-boundary-types
    toJSON() {
      return {
        ...super.toJSON(),
        listening: this.isListening,
        "opt. functionality": this.optionalFunctionality,
        genericDeviceClass: this.genericDeviceClass,
        specificDeviceClass: this.specificDeviceClass
      };
    }
  };
  return ApplicationTypeFile2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ApplicationTypeFile,
  ApplicationTypeFileID
});
//# sourceMappingURL=ApplicationTypeFile.js.map
