class SubmitChangeRequestScreenPresenter {

    public void submit() {
        if (!validateFields()) {
            return;
        }

        busyIndicatorView.showBusyIndicator(ts.getTranslation(LibraryConstants.Loading));

        projectController.canSubmitChangeRequest(workspaceProject,
                                                 selectedBranch).then(userCanSubmitChangeRequest -> {
            if (Boolean.TRUE.equals(userCanSubmitChangeRequest)) {
                changeRequestService.call((final ChangeRequest item) -> {
                    busyIndicatorView.hideBusyIndicator();

                    notificationEvent.fire(
                            new NotificationEvent(ts.format(LibraryConstants.ChangeRequestSubmitMessage,
                                                            item.getId()),
                                                  NotificationEvent.NotificationType.SUCCESS));

                    destroyDiffItems();

                    this.libraryPlaces.goToChangeRequestReviewScreen(item.getId());
                }, createChangeRequestErrorCallback())
                        .createChangeRequest(workspaceProject.getSpace().getName(),
                                             workspaceProject.getRepository().getAlias(),
                                             currentBranchName,
                                             selectedBranch,
                                             view.getSummary(),
                                             view.getDescription());
            }
            return promises.resolve();
        });
    }

    @Inject public  SubmitChangeRequestScreenPresenter(final View view,
                                              final TranslationService ts,
                                              final LibraryPlaces libraryPlaces,
                                              final ManagedInstance<DiffItemPresenter> diffItemPresenterInstances,
                                              final Caller<ChangeRequestService> changeRequestService,
                                              final ProjectController projectController,
                                              final Promises promises,
                                              final BusyIndicatorView busyIndicatorView,
                                              final ChangeRequestUtils changeRequestUtils,
                                              final Event<NotificationEvent> notificationEvent);

}