package cz.senslog.analytics.utils.newvalidator;

import java.util.Optional;
import java.util.function.Supplier;

public interface NotifyTrigger {

    Optional<NotifyReport> accept(ValidationResult validationResult);

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

        ;

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

        private final Supplier<NotifyTrigger> constructCreator;

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

        public static NotifyTrigger.Mode of(String mode) {
            return NotifyTrigger.Mode.valueOf(mode.toUpperCase());
        }
    }

}