import { type ConditionLineValues, type DefaultItemType } from './types';

export const isConditionEmpty = <
  FieldItemType extends DefaultItemType,
  ValueItemType extends DefaultItemType,
>(
  values: ConditionLineValues<FieldItemType, ValueItemType>,
) => {
  if (!values) return true;
  const { field, value } = values;

  const isFieldEmpty = field === null || field === undefined;
  const isValueEmpty = !value?.length;

  return isFieldEmpty || isValueEmpty;
};
