class ProjectDeleteService {

	@UseCaseAdministratorDeleteProject(@Step(number = 2, name = "Service deletes projects.", next = { 3, 4,
			5, 6, 7}, description = "The service will delete the project with dependencies and triggers asynchronous events"))
	public void deleteProject(String projectId) {
		auditLogService.log("triggers delete of project {}", logSanitizer.sanitize(projectId, 30));

		assertion.isValidProjectId(projectId);

		Project project = projectRepository.findOrFailProject(projectId);

		/* create message containing data before project is deleted */
		ProjectMessage message = new ProjectMessage();
		message.setProjectId(project.getId());
		message.setProjectActionTriggeredBy(userContext.getUserId());

		User owner = project.getOwner();
		if (owner == null) {
			LOG.warn("No owner found for project {} while deleting", project.getId());
		} else {
			message.setProjectOwnerEmailAddress(owner.getEmailAdress());
		}

		for (User user : project.getUsers()) {
			message.addUserEmailAddress(user.getEmailAdress());
		}

		transactionService.deleteWithAssociationsInOwnTransaction(projectId);

		informProjectDeleted(message);
		if (owner != null) {
			sendRefreshUserAuth(owner);
		}

	}

}