/*
 * Copyright 2000-2015 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jetbrains.python.run;

import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.process.ProcessOutput;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.jetbrains.python.remote.PyRemotePathMapper;
import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase;
import com.jetbrains.python.remote.PythonRemoteInterpreterManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Set;

/**
 * @author Alexander Koshevoy
 */
public interface PyRemoteProcessStarterManager {
  ExtensionPointName<PyRemoteProcessStarterManager> EP_NAME = ExtensionPointName.create("Pythonid.remoteProcessStarterManager");

  boolean supports(@NotNull PyRemoteSdkAdditionalDataBase sdkAdditionalData);

  @NotNull
  ProcessHandler startRemoteProcess(@Nullable Project project,
                                    @NotNull GeneralCommandLine commandLine,
                                    @NotNull PythonRemoteInterpreterManager manager,
                                    @NotNull PyRemoteSdkAdditionalDataBase sdkAdditionalData,
                                    @NotNull PyRemotePathMapper pathMapper) throws ExecutionException, InterruptedException;

  /**
   * Please <b>do not use</b> in new code. Consider introducing a separate
   * extension point with implementations for different
   * {@link com.intellij.remote.CredentialsType} using
   * {@link PyRemoteSdkAdditionalDataBase#switchOnConnectionType(com.intellij.remote.ext.CredentialsCase[])}.
   *
   * @deprecated <b>do not use</b> in new code
   */
  @Deprecated
  @NotNull
  ProcessOutput executeRemoteProcess(@Nullable Project project,
                                     @NotNull String[] command,
                                     @Nullable String workingDir,
                                     @NotNull PythonRemoteInterpreterManager manager,
                                     @NotNull PyRemoteSdkAdditionalDataBase sdkAdditionalData,
                                     @NotNull PyRemotePathMapper pathMapper, boolean askForSudo, boolean checkHelpers) throws ExecutionException, InterruptedException;

  /**
   * Please <b>do not use</b> in new code. Consider introducing a separate
   * extension point with implementations for different
   * {@link com.intellij.remote.CredentialsType} using
   * {@link PyRemoteSdkAdditionalDataBase#switchOnConnectionType(com.intellij.remote.ext.CredentialsCase[])}.
   *
   * @deprecated <b>do not use</b> in new code
   */
  @Deprecated
  default ProcessOutput executeRemoteProcess(@Nullable Project project,
                                            @NotNull String[] command,
                                            @Nullable String workingDir,
                                            @NotNull PythonRemoteInterpreterManager manager,
                                            @NotNull PyRemoteSdkAdditionalDataBase sdkAdditionalData,
                                            @NotNull PyRemotePathMapper pathMapper,
                                            boolean askForSudo,
                                            @NotNull Set<String> checkHelpersPaths) throws ExecutionException, InterruptedException {
    return executeRemoteProcess(project, command, workingDir, manager, sdkAdditionalData, pathMapper, askForSudo, !checkHelpersPaths.isEmpty());
  }

  String getFullInterpreterPath(@NotNull PyRemoteSdkAdditionalDataBase sdkAdditionalData)
    throws ExecutionException, InterruptedException;
}

@@ -1233,31 +1233,8 @@
 e;%0A%0A
-import java.util.Set;%0A%0A
 /**%0A
@@ -1985,382 +1985,8 @@
 n;%0A%0A
-  /**%0A   * Please %3Cb%3Edo not use%3C/b%3E in new code. Consider introducing a separate%0A   * extension point with implementations for different%0A   * %7B@link com.intellij.remote.CredentialsType%7D using%0A   * %7B@link PyRemoteSdkAdditionalDataBase#switchOnConnectionType(com.intellij.remote.ext.CredentialsCase%5B%5D)%7D.%0A   *%0A   * @deprecated %3Cb%3Edo not use%3C/b%3E in new code%0A   */%0A  @Deprecated%0A
   @N
@@ -2190,94 +2190,8 @@
 ir,%0A
-                                     @NotNull PythonRemoteInterpreterManager manager,%0A
     
@@ -2360,50 +2360,8 @@
 pper
-, boolean askForSudo, boolean checkHelpers
 ) th
@@ -2412,1225 +2412,8 @@
 n;%0A%0A
-  /**%0A   * Please %3Cb%3Edo not use%3C/b%3E in new code. Consider introducing a separate%0A   * extension point with implementations for different%0A   * %7B@link com.intellij.remote.CredentialsType%7D using%0A   * %7B@link PyRemoteSdkAdditionalDataBase#switchOnConnectionType(com.intellij.remote.ext.CredentialsCase%5B%5D)%7D.%0A   *%0A   * @deprecated %3Cb%3Edo not use%3C/b%3E in new code%0A   */%0A  @Deprecated%0A  default ProcessOutput executeRemoteProcess(@Nullable Project project,%0A                                            @NotNull String%5B%5D command,%0A                                            @Nullable String workingDir,%0A                                            @NotNull PythonRemoteInterpreterManager manager,%0A                                            @NotNull PyRemoteSdkAdditionalDataBase sdkAdditionalData,%0A                                            @NotNull PyRemotePathMapper pathMapper,%0A                                            boolean askForSudo,%0A                                            @NotNull Set%3CString%3E checkHelpersPaths) throws ExecutionException, InterruptedException %7B%0A    return executeRemoteProcess(project, command, workingDir, manager, sdkAdditionalData, pathMapper, askForSudo, !checkHelpersPaths.isEmpty());%0A  %7D%0A%0A
   St

Simplify the signature of PyRemoteProcessStarterManager.executeRemoteProcess()