class UserDeleteService {

	@Validated
	@UseCaseAdministratorDeletesUser(
			@Step(
					number = 2,
					name = "Service deletes user.",
					next = { 3,	4 },
					description = "The service will delete the user with dependencies and triggers asynchronous events"))
	/* @formatter:on */
	@Transactional
	public void deleteUser(String userId) {
		auditLogService.log("Triggers delete of user {}",logSanitizer.sanitize(userId,30));

		assertion.isValidUserId(userId);
		if (userId.contentEquals(userContext.getUserId())) {
			throw new NotAcceptableException("You are not allowed to delete yourself!");
		}

		User user = userRepository.findOrFailUser(userId);

		/* create message containing data before user is deleted */
		UserMessage message = new UserMessage();
		message.setUserId(user.getName());
		message.setEmailAdress(user.getEmailAdress());

		userRepository.deleteUserWithAssociations(user.getName());

		informUserDeleted(message);

	}

}