package cz.senslog.analytics.domain;

import java.util.ArrayList;
import java.util.List;

public class ValidationResult {

    public record Record(ThresholdMode mode, double thresholdValue) {}

    private final double validatedValue;
    private final AttributeType attributeType;
    private final List<Record> records;

    public ValidationResult(AttributeType attributeType, double validatedValue) {
        this.attributeType = attributeType;
        this.validatedValue = validatedValue;
        this.records = new ArrayList<>();
    }

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

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

    public List<Record> records() {
        return records;
    }

    public double validatedValue() {
        return validatedValue;
    }

    public AttributeType attributeType() {
        return attributeType;
    }

    public void addRecord(ThresholdMode mode, double thresholdValue) {
        records.add(new Record(mode, thresholdValue));
    }
}
