package cz.senslog.analytics.utils.validator;


import cz.senslog.analytics.domain.ValidationResult;

import java.util.function.Supplier;

public interface NotifyTrigger {

    void accept(ValidationResult validationResult);

    boolean shouldNotify();
    ValidationResult[] resultsToNotify();

    enum Mode {
        DISABLED    (DisableNotifyTrigger::new),
        INSTANT     (InstantNotifyTrigger::new),
        ON_CHANGE   (OnChangeNotifyTrigger::new),

        ;

        Mode(Supplier<NotifyTrigger> constructCreator) {
            this.constructCreator = constructCreator;
        }

        private final Supplier<NotifyTrigger> constructCreator;

        public NotifyTrigger createInstance() {
            return constructCreator.get();
        }
    }


}
