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 ) String 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<String> uuids );

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

}

@@ -1139,22 +1139,20 @@
 h( ID ) 
-String
+UUID
  uuid );
@@ -1611,22 +1611,20 @@
 ody Set%3C
-String
+UUID
 %3E uuids 

update sharingapi v2 for uuids