package cz.senslog.analytics.utils.validator;

import cz.senslog.analytics.domain.AttributeType;
import cz.senslog.analytics.domain.ThresholdDimension;
import cz.senslog.analytics.domain.ThresholdViolationAlert;
import cz.senslog.analytics.utils.newvalidator.MessageFormatter;
import cz.senslog.analytics.utils.validator.domain.ValidationResult;
import org.junit.jupiter.api.Test;

import java.time.OffsetDateTime;
import java.util.List;

import static java.util.Collections.emptyList;
import static org.junit.jupiter.api.Assertions.*;

class MessageFormatterTest {

    @Test
    void isValid() {

        final String test1 = "V Modulu $module hodnota $val(%.2f) překročila práh $VAL >= 25 °C v čase $timestamp.";
        final String test2 = "$val >= 25 & 12h <= $timestamp(HH:mm) <= 15h v čase $timestamp.";
        final String test3 = "$timestamp | $val";

        List<ThresholdDimension> thresholdDimensions = List.of(
                ThresholdDimension.of(1, null, AttributeType.VAL, null),
                ThresholdDimension.of(2, null, AttributeType.TIME, null)
        );

//        MessageFormatter formatter = MessageFormatter.create();
//        for (String test : new String[]{test1, test2, test3}) {
//            assertTrue(formatter.isValid(test, thresholdDimensions));
//
//            String message = formatter.format(ThresholdViolationAlert.of("moduleName", 1, "sourceName", test, new ValidationResult[]{
//                    new ValidationResult(AttributeType.VAL, 25.3432, emptyList()), new ValidationResult(AttributeType.TIME, 48800, emptyList())
//            }, OffsetDateTime.now()));
//
//            System.out.println(message);
//        }
    }
}