"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 ResourceMonitoring_exports = {};
__export(ResourceMonitoring_exports, {
  ResourceMonitoring: () => ResourceMonitoring
});
module.exports = __toCommonJS(ResourceMonitoring_exports);
var import_MatterDefinition = require("../MatterDefinition.js");
var import_elements = require("../../elements/index.js");
/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const ResourceMonitoring = (0, import_elements.ClusterElement)({
  name: "ResourceMonitoring",
  classification: "application",
  pics: "REPM",
  details: "This generic cluster provides an interface to the current condition of a resource. A resource is a component of a device that is designed to be replaced, refilled, or emptied when exhausted or full. Examples of resources include filters, cartridges, and water tanks. While batteries fit this definition they are not intended to be used with this cluster. Use the power source cluster for batteries instead.\nNOTE\nThis cluster is not meant to be used for monitoring of the system resources, such as processing, memory utilization, networking properties, etc.\nThis cluster shall be used via an alias to a specific resource type (see Cluster IDs).",
  xref: { document: "cluster", section: "2.8" },
  children: [
    (0, import_elements.AttributeElement)({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 1 }),
    (0, import_elements.AttributeElement)({
      name: "FeatureMap",
      id: 65532,
      type: "FeatureMap",
      xref: { document: "cluster", section: "2.8.4" },
      children: [
        (0, import_elements.FieldElement)({
          name: "CON",
          conformance: "O",
          constraint: "0",
          description: "Condition",
          details: "Supports monitoring the condition of the resource in percentage"
        }),
        (0, import_elements.FieldElement)({
          name: "WRN",
          conformance: "O",
          constraint: "1",
          description: "Warning",
          details: "Supports warning indication"
        }),
        (0, import_elements.FieldElement)({
          name: "REP",
          conformance: "O",
          constraint: "2",
          description: "ReplacementProductList",
          details: "Supports specifying the list of replacement products"
        })
      ]
    }),
    (0, import_elements.AttributeElement)({
      name: "Condition",
      id: 0,
      type: "percent",
      access: "R V",
      conformance: "CON",
      details: "Indicates the current condition of the resource in percent.",
      xref: { document: "cluster", section: "2.8.6.1" }
    }),
    (0, import_elements.AttributeElement)({
      name: "DegradationDirection",
      id: 1,
      type: "DegradationDirectionEnum",
      access: "R V",
      conformance: "CON",
      constraint: "desc",
      quality: "F",
      details: "Indicates the direction of change for the condition of the resource over time, which helps to determine whether a higher or lower condition value is considered optimal.",
      xref: { document: "cluster", section: "2.8.6.2" }
    }),
    (0, import_elements.AttributeElement)({
      name: "ChangeIndication",
      id: 2,
      type: "ChangeIndicationEnum",
      access: "R V",
      conformance: "M",
      default: 0,
      details: "This attribute shall be populated with a value from ChangeIndicationEnum that is indicative of the current requirement to change the resource.",
      xref: { document: "cluster", section: "2.8.6.3" }
    }),
    (0, import_elements.AttributeElement)({
      name: "InPlaceIndicator",
      id: 3,
      type: "bool",
      access: "R V",
      conformance: "O",
      details: "Indicates whether a resource is currently installed. A value of true shall indicate that a resource is installed. A value of false shall indicate that a resource is not installed.",
      xref: { document: "cluster", section: "2.8.6.4" }
    }),
    (0, import_elements.AttributeElement)({
      name: "LastChangedTime",
      id: 4,
      type: "epoch-s",
      access: "RW VO",
      conformance: "O",
      default: null,
      quality: "X N",
      details: "This attribute may indicates the time at which the resource has been changed, if supported by the server. The attribute shall be null if it was never set or is unknown.",
      xref: { document: "cluster", section: "2.8.6.5" }
    }),
    (0, import_elements.AttributeElement)({
      name: "ReplacementProductList",
      id: 5,
      type: "list",
      access: "R V",
      conformance: "REP",
      constraint: "max 5",
      quality: "F",
      details: "Indicates the list of supported products that may be used as replacements for the current resource. Each item in this list represents a unique ReplacementProductStruct.",
      xref: { document: "cluster", section: "2.8.6.6" },
      children: [(0, import_elements.FieldElement)({ name: "entry", type: "ReplacementProductStruct" })]
    }),
    (0, import_elements.CommandElement)({
      name: "ResetCondition",
      id: 0,
      access: "O",
      conformance: "O",
      direction: "request",
      response: "status",
      details: "Upon receipt, the device shall reset the Condition and ChangeIndicator attributes, indicating full resource availability and readiness for use, as initially configured. Invocation of this command may cause the LastChangedTime to be updated automatically based on the clock of the server, if the server supports setting the attribute.",
      xref: { document: "cluster", section: "2.8.7.1" }
    }),
    (0, import_elements.DatatypeElement)({
      name: "DegradationDirectionEnum",
      type: "enum8",
      details: "Indicates the direction in which the condition of the resource changes over time.",
      xref: { document: "cluster", section: "2.8.5.1" },
      children: [
        (0, import_elements.FieldElement)({
          name: "Up",
          id: 0,
          conformance: "M",
          description: "The degradation of the resource is indicated by an upwards moving/increasing value"
        }),
        (0, import_elements.FieldElement)({
          name: "Down",
          id: 1,
          conformance: "M",
          description: "The degradation of the resource is indicated by a downwards moving/decreasing value"
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "ChangeIndicationEnum",
      type: "enum8",
      xref: { document: "cluster", section: "2.8.5.2" },
      children: [
        (0, import_elements.FieldElement)({
          name: "Ok",
          id: 0,
          conformance: "M",
          description: "Resource is in good condition, no intervention required"
        }),
        (0, import_elements.FieldElement)({
          name: "Warning",
          id: 1,
          conformance: "WRN",
          description: "Resource will be exhausted soon, intervention will shortly be required"
        }),
        (0, import_elements.FieldElement)({
          name: "Critical",
          id: 2,
          conformance: "M",
          description: "Resource is exhausted, immediate intervention is required"
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "ProductIdentifierTypeEnum",
      type: "enum8",
      details: "Indicate the type of identifier used to describe the product. Devices SHOULD use globally-recognized IDs over OEM specific ones.",
      xref: { document: "cluster", section: "2.8.5.3" },
      children: [
        (0, import_elements.FieldElement)({ name: "Upc", id: 0, conformance: "M", description: "12-digit Universal Product Code" }),
        (0, import_elements.FieldElement)({ name: "Gtin8", id: 1, conformance: "M", description: "8-digit Global Trade Item Number" }),
        (0, import_elements.FieldElement)({ name: "Ean", id: 2, conformance: "M", description: "13-digit European Article Number" }),
        (0, import_elements.FieldElement)({ name: "Gtin14", id: 3, conformance: "M", description: "14-digit Global Trade Item Number" }),
        (0, import_elements.FieldElement)({
          name: "Oem",
          id: 4,
          conformance: "M",
          description: "Original Equipment Manufacturer part number"
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "ReplacementProductStruct",
      type: "struct",
      details: "Indicates the product identifier that can be used as a replacement for the resource.",
      xref: { document: "cluster", section: "2.8.5.4" },
      children: [
        (0, import_elements.FieldElement)({
          name: "ProductIdentifierType",
          id: 0,
          type: "ProductIdentifierTypeEnum",
          conformance: "M",
          constraint: "desc"
        }),
        (0, import_elements.FieldElement)({ name: "ProductIdentifierValue", id: 1, type: "string", conformance: "M", constraint: "max 20" })
      ]
    })
  ]
});
import_MatterDefinition.MatterDefinition.children.push(ResourceMonitoring);
//# sourceMappingURL=ResourceMonitoring.js.map
