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 Type {
        DISABLED    (DisableNotifyTrigger::new),
        INSTANT     (InstantNotifyTrigger::new),
        ON_CHANGE   (OnChangeNotifyTrigger::new),

        ;

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

        private final Supplier<NotifyTrigger> constructCreator;

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


}
