class AccountConsentValidator {

    public ValidationResult validate(AisConsent aisConsent, String requestUri) {
        if (LocalDate.now().compareTo(aisConsent.getValidUntil()) > 0) {
            return ValidationResult.invalid(AIS_401, CONSENT_EXPIRED);
        }

        ConsentStatus consentStatus = aisConsent.getConsentStatus();
        if (consentStatus != ConsentStatus.VALID) {
            return processConsentInvalidStatus(consentStatus);
        }

        if (isAccessExceeded(aisConsent, requestUri)) {
            return ValidationResult.invalid(AIS_429, ACCESS_EXCEEDED);
        }

        return ValidationResult.valid();
    }

}