class GetTrustedBeneficiariesListValidator extends AbstractAccountTppValidator<GetTrustedBeneficiariesListConsentObject> {

    @NotNull
    @Override
    protected ValidationResult executeBusinessValidation(GetTrustedBeneficiariesListConsentObject consentObject) {
        AisConsent aisConsent = consentObject.getAisConsent();

        ValidationResult accountConsentValidationResult = accountConsentValidator.validate(aisConsent, consentObject.getRequestUri());

        if (accountConsentValidationResult.isNotValid()) {
            return accountConsentValidationResult;
        }

        if (!aspspProfileService.isTrustedBeneficiariesSupported()) {
            return ValidationResult.invalid(AIS_405, MessageErrorCode.SERVICE_INVALID_405);
        }

        if (aisConsent.isGlobalConsent()) {
            return ValidationResult.valid();
        }

        if (aisConsent.isConsentForAllAvailableAccounts()) {
            return ValidationResult.invalid(AIS_401, MessageErrorCode.CONSENT_INVALID);
        }

        if (doesNotDedicatedConsentHaveRights(aisConsent)) {
            return ValidationResult.invalid(AIS_401, MessageErrorCode.CONSENT_INVALID);
        }

        return ValidationResult.valid();
    }

}