package cz.senslog.analytics.utils.validator.domain;

import cz.senslog.analytics.domain.AttributeType;
import cz.senslog.analytics.domain.ComparisonOperator;

import java.util.List;

public class ValidationResult {

    public record Rule(ComparisonOperator operator, double thresholdValue) {}

    private final double validatedValue;
    private final AttributeType attributeType;
    private final List<Rule> violatedRules;

    public ValidationResult(AttributeType attributeType, double validatedValue, List<Rule> violatedRules) {
        this.attributeType = attributeType;
        this.validatedValue = validatedValue;
        this.violatedRules = violatedRules;
    }

    public boolean isValid() {
        return violatedRules.isEmpty();
    }

    public boolean isNotValid() {
        return !isValid();
    }

    public List<Rule> records() {
        return violatedRules;
    }

    public double validatedValue() {
        return validatedValue;
    }

    public AttributeType attributeType() {
        return attributeType;
    }
}
