package adullact.publicrowdfunding.model.server.entities;

import java.util.ArrayList;
import java.util.Map;

import retrofit.http.Body;
import retrofit.http.DELETE;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.PUT;
import retrofit.http.Path;
import retrofit.http.QueryMap;
import rx.Observable;

/**
 * Created by Ferrand on 21/07/2014.
 */
public interface Service {
    // Check
    @GET("/authentication/")
    Observable<SimpleServerResponse> authenticate();
    @FormUrlEncoded
    @POST("/registration/")
    Observable<ServerRegistrationResponse> register(@Field("username") String username, @Field("password") String password, @Field("pseudo") String pseudo);

    // Accounts
    @GET("/account/{name}")
    Observable<ServerAccount> detailAccount(@Path("name") String name);
    @GET("/account/")
    Observable<ArrayList<ServerAccount>> listAccount(@QueryMap Map<String, String> filter);
    @POST("/account/")
    Observable<RowAffected> createAccount(@Body ServerAccount serverAccount);
    @PUT("/account/{name}")
    Observable<SimpleServerResponse> modifyAccount(@Body ServerAccount serverAccount, @Path("name") String name);
    @DELETE("/account/{name}")
    Observable<SimpleServerResponse> deleteAccount(@Path("name") String name);

    // Users
    @GET("/user/{username}")
    Observable<DetailedServerUser> detailUser(@Path("username") String username);
    @GET("/user/")
    Observable<ArrayList<ServerUser>> listUsers(@QueryMap Map<String, String> filter);
    @POST("/user/")
    Observable<RowAffected> createUser(@Body ServerUser serverUser);
    @PUT("/user/{username}")
    Observable<SimpleServerResponse> modifyUser(@Body ServerUser serverUser, @Path("username") String username);
    @DELETE("/user/{username}")
    Observable<SimpleServerResponse> deleteUser(@Path("username") String username);

    // Projects
    @GET("/project/{projectID}")
    Observable<DetailedServerProject> detailProject(@Path("projectID") String projectID);
    @GET("/project/")
    Observable<ArrayList<ServerProject>> listProjects(@QueryMap Map<String, String> filter);
    @POST("/projec/")
    Observable<RowAffected> createProject(@Body ServerProject serverProject);
    @PUT("/project/{projectID}")
    Observable<SimpleServerResponse> modifyProject(@Path("projectID") String projectID, @Body ServerProject serverProject);
    @DELETE("/project/{projectID}")
    Observable<SimpleServerResponse> deleteProject(@Path("projectID") String projectID);

    // Funding
    @GET("/funding/{id}")
    Observable<ServerFunding> detailFunding(@Path("id") String id);
    @GET("/funding/")
    Observable<ArrayList<ServerFunding>> listFunding(@QueryMap Map<String, String> filter);
    @POST("/funding/")
    Observable<RowAffected> createFunding(@Body ServerFunding serverFunding);
    @PUT("/funding/{id}")
    Observable<SimpleServerResponse> modifyFunding(@Path("id") String id, @Body ServerFunding serverFunding);
    @DELETE("/funding/{id}")
    Observable<SimpleServerResponse> deleteFunding(@Path("id") String id);

    // Commentaries
    @GET("/commentary/")
    Observable<ArrayList<ServerCommentary>> listCommentaries(@QueryMap Map<String, String> filter);
    @GET("/commentary/{id}")
    Observable<ServerCommentary> detailCommentary(@Path("id") String id);
    @POST("/commentary/")
    Observable<RowAffected> createCommentary(@Body ServerCommentary serverCommentary);
    @PUT("/commentary/{commentaryID}")
    Observable<SimpleServerResponse> modifyCommentary(@Path("commentaryID") String commentaryID, @Body ServerCommentary serverCommentary);
    @DELETE("/commentary/{commentaryID}")
    Observable<SimpleServerResponse> deleteCommentary(@Path("commentaryID") String commentaryID);

    // Bookmarks
    @GET("/bookmark/")
    Observable<ArrayList<ServerBookmark>> listBookmarks(@QueryMap Map<String, String> filter);
    @GET("/bookmark/{id}")
    Observable<ServerBookmark> detailBookmark(@Path("id") String id);
    @POST("/bookmark/")
    Observable<RowAffected> createBookmark(@Body ServerBookmark serverBookmark);
    @PUT("/bookmark/{id}")
    Observable<SimpleServerResponse> modifyBookmark(@Path("id") String id, @Body ServerBookmark serverBookmark);
    @DELETE("/bookmark/{id}")
    Observable<SimpleServerResponse> deleteBookmark(@Path("id") String id);
}

@@ -2191,16 +2191,17 @@
 %22/projec
+t
 /%22)%0A    

Fix bad request on project submission