"use strict";
var import_elements = require("../../elements/index.js");
var import_models = require("../../models/index.js");
var import_ModelValidator = require("./ModelValidator.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import_ModelValidator.ModelValidator.validators[import_elements.CommandElement.Tag] = class CommandValidator extends import_ModelValidator.ModelValidator {
  validate() {
    this.validateStructure(true, import_models.FieldModel);
    this.validateProperty({
      name: "effectiveDirection",
      type: import_elements.CommandElement.Direction,
      required: true
    });
    this.validateProperty({
      name: "response",
      type: "string"
    });
    const response = this.model.response;
    if (response && response !== "status") {
      const responseModel = this.model.responseModel;
      if (!responseModel) {
        this.error("RESPONSE_NOT_FOUND", `response type ${response} not found`);
      } else if (!(responseModel instanceof import_models.ValueModel)) {
        this.error("INVALID_RESPONSE_TYPE", `response type ${response} is not a ValueModel`);
      }
    }
    super.validate();
  }
};
//# sourceMappingURL=CommandValidator.js.map
