/*
 * Copyright 2015 Netflix, Inc.
 *
 * 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.netflix.spinnaker.clouddriver.titus.client;

import com.netflix.spinnaker.clouddriver.titus.client.model.*;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.*;

import java.util.List;
import java.util.Map;

public interface TitusRestAdapter {

    @GET("/v2/jobs/{jobId}")
    Call<Job> getJob(@Path("jobId") String jobId);

    @POST("/v2/jobs")
    Call<SubmitJobResponse> submitJob(@Body JobDescription jobDescription);

    @PATCH("/v2/jobs/{jobId}")
    Call<Void> updateJob(@Path("jobId") String jobId, @Body Map<String, Object>jobAttributes);

    @POST("/v2/jobs/kill")
    Call<Void> killJob(@Body TerminateJobRequest terminateJobRequest);

    @GET("/v2/tasks/{taskId}")
    Call<Task> getTask(@Path("taskId") String taskId);

    @GET("/v2/jobs")
    Call<List<Job>> getJobsByTaskState(@Query("taskState") TaskState taskState);

    @GET("/v2/jobs")
    Call<List<Job>> getJobsByType(@Query("type") String type);

    @GET("/v2/jobs")
    Call<List<Job>> getJobsByLabel(@Query("labels") String labels);

    @GET("/v2/jobs")
    Call<List<Job>> getJobsByUser(@Query("user") String user);

    @GET("/v2/jobs")
    Call<List<Job>> getJobsByApplication(@Query("appName") String application);

    @POST("/api/v2/tasks/kill")
    Call<Void> terminateTasksAndShrink(@Body TerminateTasksAndShrinkJobRequest terminateTasksAndShrinkJobRequest);

    @GET("/api/v2/logs/download/{taskId}")
    Call<Map> logsDownload(@Path("taskId") String taskId);

    @POST("/v2/jobs/setinstancecounts")
    Call<Void> resizeJob(@Body ResizeJobRequest resizeJob);

    @POST("/v2/jobs/setinservice")
    Call<Void> activateJob(@Body ActivateJobRequest activateJob);
}

@@ -877,24 +877,28 @@
 %0A    @GET(%22/
+api/
 v2/jobs/%7Bjob
@@ -895,32 +895,32 @@
 /jobs/%7BjobId%7D%22)%0A
-
     Call%3CJob%3E ge
@@ -963,24 +963,28 @@
     @POST(%22/
+api/
 v2/jobs%22)%0A  
@@ -1071,16 +1071,20 @@
 PATCH(%22/
+api/
 v2/jobs/
@@ -1193,32 +1193,36 @@
 );%0A%0A    @POST(%22/
+api/
 v2/jobs/kill%22)%0A 
@@ -1303,16 +1303,20 @@
  @GET(%22/
+api/
 v2/tasks
@@ -1398,110 +1398,11 @@
 T(%22/
-v2/jobs%22)%0A    Call%3CList%3CJob%3E%3E getJobsByTaskState(@Query(%22taskState%22) TaskState taskState);%0A%0A    @GET(%22
+api
 /v2/
@@ -1475,32 +1475,36 @@
 e);%0A%0A    @GET(%22/
+api/
 v2/jobs%22)%0A    Ca
@@ -1581,92 +1581,11 @@
 T(%22/
-v2/jobs%22)%0A    Call%3CList%3CJob%3E%3E getJobsByUser(@Query(%22user%22) String user);%0A%0A    @GET(%22
+api
 /v2/
@@ -1927,32 +1927,36 @@
 );%0A%0A    @POST(%22/
+api/
 v2/jobs/setinsta
@@ -2024,24 +2024,24 @@
 esizeJob);%0A%0A
-
     @POST(%22/
@@ -2040,16 +2040,20 @@
 @POST(%22/
+api/
 v2/jobs/

use api/v2 endpoints