package cz.senslog.analytics.domain;

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

public class ValidationResult {

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

    private final double validatedValue;
    private final AttributeName attribute;
    private final List<Record> records;

    public ValidationResult(AttributeName attribute, double validatedValue) {
        this.attribute = attribute;
        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 AttributeName attribute() {
        return attribute;
    }

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