/**
 * DevExtreme (esm/__internal/ui/m_validation_group.js)
 * Version: 24.1.7-build-24272-1937
 * Build date: Sat Sep 28 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import registerComponent from "../../core/component_registrator";
import DOMComponent from "../../core/dom_component";
import $ from "../../core/renderer";
import ValidationEngine from "./m_validation_engine";
import ValidationSummary from "./m_validation_summary";
import Validator from "./m_validator";
const VALIDATION_ENGINE_CLASS = "dx-validationgroup";
const VALIDATOR_CLASS = "dx-validator";
const VALIDATION_SUMMARY_CLASS = "dx-validationsummary";
class ValidationGroup extends DOMComponent {
    _getDefaultOptions() {
        return super._getDefaultOptions()
    }
    _init() {
        super._init();
        ValidationEngine.addGroup(this, false)
    }
    _initMarkup() {
        const $element = this.$element();
        $element.addClass("dx-validationgroup");
        $element.find(".dx-validator").each(((_, validatorContainer) => {
            Validator.getInstance($(validatorContainer))._initGroupRegistration()
        }));
        $element.find(".dx-validationsummary").each(((_, summaryContainer) => {
            ValidationSummary.getInstance($(summaryContainer)).refreshValidationGroup()
        }));
        super._initMarkup()
    }
    validate() {
        return ValidationEngine.validateGroup(this)
    }
    reset() {
        return ValidationEngine.resetGroup(this)
    }
    _dispose() {
        ValidationEngine.removeGroup(this);
        this.$element().removeClass("dx-validationgroup");
        super._dispose()
    }
    _useTemplates() {
        return false
    }
}
registerComponent("dxValidationGroup", ValidationGroup);
export default ValidationGroup;
