"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 RequirementModel_exports = {};
__export(RequirementModel_exports, {
  RequirementModel: () => RequirementModel
});
module.exports = __toCommonJS(RequirementModel_exports);
var import_aspects = require("../aspects/index.js");
var import_common = require("../common/index.js");
var import_elements = require("../elements/index.js");
var import_Model = require("./Model.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class RequirementModel extends import_Model.Model {
  tag = import_elements.RequirementElement.Tag;
  #constraint;
  #conformance;
  #access;
  #quality;
  get discriminator() {
    return this.element;
  }
  get constraint() {
    return this.#constraint;
  }
  set constraint(definition) {
    this.#constraint = import_aspects.Constraint.create(definition);
  }
  get conformance() {
    return this.#conformance;
  }
  set conformance(definition) {
    this.#conformance = import_aspects.Conformance.create(definition);
  }
  get access() {
    return this.#access;
  }
  set access(definition) {
    this.#access = import_aspects.Access.create(definition);
  }
  get quality() {
    return this.#quality;
  }
  set quality(definition) {
    this.#quality = import_aspects.Quality.create(definition);
  }
  /**
   * Condition requirements may derive from ConditionElement models via qualified types
   * (e.g. type: "RootNode.AclExtensionCond").
   */
  get allowedBaseTags() {
    if (this.element === import_elements.RequirementElement.ElementType.Condition) {
      return [this.tag, import_common.ElementTag.Condition];
    }
    return [this.tag];
  }
  get requirements() {
    return this.all(RequirementModel);
  }
  /**
   * Is the element mandatory?
   */
  get isMandatory() {
    return this.conformance.isMandatory;
  }
  /**
   * Is the element disallowed?
   */
  get isDisallowed() {
    return this.conformance.isDisallowed;
  }
  constructor(definition, ...children) {
    super(definition, ...children);
    this.element = definition.element;
    this.default = definition.default;
    this.instance = definition.instance;
    this.#constraint = import_aspects.Constraint.create(definition.constraint);
    this.#conformance = import_aspects.Conformance.create(definition.conformance);
    this.#access = import_aspects.Access.create(definition.access);
    this.#quality = import_aspects.Quality.create(definition.quality);
  }
  toElement(omitResources = false, extra) {
    return super.toElement(omitResources, {
      element: this.element,
      instance: this.instance,
      default: this.default,
      constraint: this.#constraint.valueOf(),
      conformance: this.#conformance.valueOf(),
      access: this.#access.valueOf(),
      quality: this.#quality.valueOf(),
      ...extra
    });
  }
  static Tag = import_elements.RequirementElement.Tag;
}
RequirementModel.register();
//# sourceMappingURL=RequirementModel.js.map
