package com.kryptnostic.v2.sharing.api;

import java.util.Map;
import java.util.Set;
import java.util.UUID;

import retrofit.http.Body;
import retrofit.http.DELETE;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.PUT;
import retrofit.http.Path;

import com.kryptnostic.indexing.v1.ObjectSearchPair;
import com.kryptnostic.kodex.v1.models.response.BasicResponse;
import com.kryptnostic.sharing.v1.models.response.KeyUpdateResponse;
import com.kryptnostic.v2.sharing.models.IncomingShares;
import com.kryptnostic.v2.sharing.models.RevocationRequest;
import com.kryptnostic.v2.sharing.models.SharingRequest;
import com.kryptnostic.v2.storage.models.VersionedObjectKey;

public interface SharingApi {
    String SHARE       = "/share";
    String OBJECT      = "/object";
    String REVOKE      = "/revoke";
    String KEYS        = "/keys";
    String OBJECT_KEYS = "/objectKeys";
    String ID          = "id";
    String VERSION     = "version";

    @GET( SHARE + OBJECT )
    IncomingShares getIncomingShares();

    @POST( SHARE + OBJECT + "/{" + ID + "}" )
    BasicResponse<String> removeIncomingShares( @Path( ID ) UUID uuid );

    @POST( SHARE + OBJECT + SHARE )
    BasicResponse<String> share( @Body SharingRequest request );

    @POST( SHARE + OBJECT + REVOKE )
    BasicResponse<String> revokeAccess( @Body RevocationRequest request );

    // TODO: Consider creating objects here.
    @PUT( SHARE + KEYS )
    KeyUpdateResponse addSearchPairs( @Body Map<VersionedObjectKey, ObjectSearchPair> indexPairs );

    @DELETE( SHARE + KEYS )
    KeyUpdateResponse removeKeys( @Body Set<UUID> uuids );

    @GET( SHARE + OBJECT + "/{" + ID + "}/{" + VERSION + "}" )
    byte[] getSearchPair( @Path( ID ) UUID id, @Path( VERSION ) long version );

}

@@ -106,171 +106,8 @@
 D;%0A%0A
-import retrofit.http.Body;%0Aimport retrofit.http.DELETE;%0Aimport retrofit.http.GET;%0Aimport retrofit.http.POST;%0Aimport retrofit.http.PUT;%0Aimport retrofit.http.Path;%0A%0A
 impo
@@ -222,77 +222,8 @@
 se;%0A
-import com.kryptnostic.sharing.v1.models.response.KeyUpdateResponse;%0A
 impo
@@ -454,16 +454,179 @@
 ctKey;%0A%0A
+import retrofit.http.Body;%0Aimport retrofit.http.DELETE;%0Aimport retrofit.http.GET;%0Aimport retrofit.http.POST;%0Aimport retrofit.http.PUT;%0Aimport retrofit.http.Path;%0A%0A
 public i
@@ -1373,33 +1373,25 @@
 S )%0A    
-KeyUpdateResponse
+Set%3CUUID%3E
  addSear
@@ -1498,25 +1498,17 @@
     
-KeyUpdateResponse
+Set%3CUUID%3E
  rem

use Set<UUID> instead of KeyUpdateResponse which is just a wrapper around Set<String>