import { UMB_VALIDATION_CONTEXT } from '../context/validation.context-token.js';
import { UmbControllerBase } from '../../../../libs/class-api/index.js';
const ObserveSymbol = Symbol();
export class UmbObserveValidationStateController extends UmbControllerBase {
    constructor(host, dataPath, callback, controllerAlias) {
        super(host, controllerAlias ?? 'observeValidationState_' + dataPath);
        if (dataPath) {
            this.consumeContext(UMB_VALIDATION_CONTEXT, (context) => {
                this.observe(context?.messages.hasMessagesOfPathAndDescendant(dataPath), callback, ObserveSymbol);
            });
        }
    }
}
