/* eslint-disable import/prefer-default-export */
import { useStore } from 'stores/hooks';

export function useValidation(elementName) {
  const { $calculation } = useStore();
  const messages = $calculation.$validation[elementName]?.getMessages();

  if (messages?.length) {
    return {
      isValid: false,
      help: 'Некорректные данные',
    };
  }

  return {
    isValid: true,
  };
}
