package models.exceptions;

import java.util.List;

import lombok.experimental.SuperBuilder;
import lombok.Getter;
import lombok.AllArgsConstructor;

@SuperBuilder
public class ValidationException extends StandardError {

    @Getter
    private List<FieldError> errors;

    @Getter
    @AllArgsConstructor
    private static class FieldError {
        private String fieldName;
        private String message;
    }

    public void addError(final String fieldName, final String message) {
        this.errors.add(new FieldError(fieldName, message));
    }
}
