package com.kryptnostic.indexing.v1.http;

import java.util.UUID;

import retrofit.http.Body;
import retrofit.http.POST;
import retrofit.http.Path;

import com.google.common.base.Optional;

public interface IndexingApi {

    public static final String CONTROLLER     = "/indexing";
    public static final String ADDRESS        = "/address";
    public static final String SHARING        = "/share";
    public static final String METADATA       = "/metadata";
    public static final String ID             = "id";
    public static final String OBJECT_ID_PATH = "/{" + ID + "}";

    @POST( CONTROLLER + OBJECT_ID_PATH )
    Optional<String> storeIndex( @Path( ID ) UUID document, @Body byte[] metadata );

    @POST( CONTROLLER + ADDRESS + OBJECT_ID_PATH )
    Optional<String> storeObjectAddrMatrix( @Path( ID ) UUID document, @Body byte[] objAddrMatrix );

    @POST( CONTROLLER + SHARING + OBJECT_ID_PATH )
    Optional<String> storeSharingPair( @Path( ID ) UUID document, @Body byte[] sharingPair );

    @POST( CONTROLLER + METADATA )
    Optional<String> storeMetadataForIndexAddress( @Body byte[] addressMetadataPair );
}

@@ -36,16 +36,38 @@
 .http;%0A%0A
+import java.util.Set;%0A
 import j
@@ -109,16 +109,42 @@
 p.Body;%0A
+import retrofit.http.GET;%0A
 import r
@@ -324,16 +324,78 @@
 exing%22;%0A
+    public static final String INDEX_PAIR     = %22/indexPair%22;%0A
     publ
@@ -752,21 +752,30 @@
 g%3E store
-Index
+ObjectMetadata
 ( @Path(
@@ -785,32 +785,34 @@
  ) UUID document
+Id
 , @Body byte%5B%5D m
@@ -819,24 +819,131 @@
 etadata );%0A%0A
+    @GET( CONTROLLER + OBJECT_ID_PATH )%0A    Set%3Cbyte%5B%5D%3E getObjectMetadata( @Path( ID ) UUID documentId );%0A%0A
     @POST( C
@@ -1042,32 +1042,34 @@
  ) UUID document
+Id
 , @Body byte%5B%5D o
@@ -1081,24 +1081,138 @@
 rMatrix );%0A%0A
+    @GET( CONTROLLER + ADDRESS + OBJECT_ID_PATH )%0A    byte%5B%5D getObjectAddrMatrix( @Path( ID ) UUID documentId );%0A%0A
     @POST( C
@@ -1314,16 +1314,18 @@
 document
+Id
 , @Body 
@@ -1343,24 +1343,384 @@
 ingPair );%0A%0A
+    @GET( CONTROLLER + SHARING + OBJECT_ID_PATH )%0A    byte%5B%5D getSharingPair( @Path( ID ) UUID documentId );%0A%0A    @POST( CONTROLLER + SHARING + OBJECT_ID_PATH )%0A    Optional%3CString%3E storeIndexPair( @Path( ID ) UUID documentId, @Body byte%5B%5D indexPair );%0A%0A    @GET( CONTROLLER + SHARING + OBJECT_ID_PATH )%0A    byte%5B%5D getIndexPair( @Path( ID ) UUID documentId );%0A%0A
     @POST( C
@@ -1768,16 +1768,21 @@
 g%3E store
+Index
 Metadata
@@ -1784,21 +1784,16 @@
 adataFor
-Index
 Address(
@@ -1829,10 +1829,103 @@
 Pair );%0A
+%0A    @GET( CONTROLLER + METADATA )%0A    byte%5B%5D getIndexMetadataForAddress( byte%5B%5D address );%0A%0A
 %7D%0A

update indexing api