/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { TlvUInt8 } from "../tlv/TlvNumber.js";
import { TlvWrapper } from "../tlv/TlvWrapper.js";
function FabricIndex(value) {
  return value;
}
((FabricIndex2) => {
  FabricIndex2.NO_FABRIC = 0;
  FabricIndex2.OMIT_FABRIC = -1;
})(FabricIndex || (FabricIndex = {}));
class FabricIndexTlvWrapper extends TlvWrapper {
  constructor() {
    super(
      TlvUInt8.bound({ min: 0, max: 254 }),
      (fabricIndex) => fabricIndex === FabricIndex.OMIT_FABRIC ? void 0 : fabricIndex,
      (value) => {
        switch (value) {
          case void 0:
            return FabricIndex.OMIT_FABRIC;
          case 0:
            return FabricIndex.NO_FABRIC;
          default:
            return value;
        }
      }
    );
  }
  validate(value) {
    const wrappedValue = this.wrap(value);
    if (wrappedValue !== void 0) {
      this.underlyingSchema.validate(wrappedValue);
    }
  }
}
const TlvFabricIndex = new FabricIndexTlvWrapper();
export {
  FabricIndex,
  TlvFabricIndex
};
//# sourceMappingURL=FabricIndex.js.map
