/**
 * @license
 * Copyright 2025-2026 Open Home Foundation
 * SPDX-License-Identifier: Apache-2.0
 */
class AccessControlTargetTransformer {
  static {
    this.KEY_MAPPING = {
      "0": "cluster",
      "1": "endpoint",
      "2": "deviceType"
    };
  }
  static transform(input) {
    if (!input || typeof input !== "object") {
      throw new Error("Invalid input: expected an object");
    }
    const result = {};
    const keyMapping = AccessControlTargetTransformer.KEY_MAPPING;
    for (const key in input) {
      if (key in keyMapping) {
        const mappedKey = keyMapping[key];
        if (mappedKey) {
          const value = input[key];
          if (value === void 0) continue;
          result[mappedKey] = value;
        }
      }
    }
    return result;
  }
}
class AccessControlEntryDataTransformer {
  static {
    this.KEY_MAPPING = {
      "1": "privilege",
      "2": "authMode",
      "3": "subjects",
      "4": "targets",
      "254": "fabricIndex"
    };
  }
  static transform(input) {
    if (!input || typeof input !== "object") {
      throw new Error("Invalid input: expected an object");
    }
    const result = {};
    const keyMapping = AccessControlEntryDataTransformer.KEY_MAPPING;
    for (const key in input) {
      if (key in keyMapping) {
        const mappedKey = keyMapping[key];
        if (mappedKey) {
          const value = input[key];
          if (value === void 0) continue;
          if (mappedKey === "subjects") {
            result[mappedKey] = Array.isArray(value) ? value : void 0;
          } else if (mappedKey === "targets") {
            if (Array.isArray(value)) {
              const _targets = Object.values(value).map(
                (val) => AccessControlTargetTransformer.transform(val)
              );
              result[mappedKey] = _targets;
            } else {
              result[mappedKey] = void 0;
            }
          } else {
            result[mappedKey] = value;
          }
        }
      }
    }
    return result;
  }
}
export {
  AccessControlEntryDataTransformer,
  AccessControlTargetTransformer
};
//# sourceMappingURL=model.js.map
