package com.p3.bewoplaner.data.api.services;

import com.p3.bewoplaner.data.api.responses.GroupResponse;
import com.p3.bewoplaner.data.api.responses.MessageResponse;
import com.p3.bewoplaner.data.api.responses.MessagesResponse;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Created by imarneanu on 3/1/17.
 */
public interface ChatService {
    @GET("api/chat/groups")
    Observable<GroupResponse> getGroups();

    @GET("api/chat/messages")
    Observable<MessagesResponse> getMessages(@Query("groupid") long groupId,
                                             @Query("page") int page);

    @Multipart
    @POST("api/chat/messages/send")
    Observable<MessageResponse> sendFile(
            @Part("groupid") RequestBody groupid,
            @Part MultipartBody.Part file
    );

    @FormUrlEncoded
    @POST("api/chat/messages/send")
    Observable<MessageResponse> sendMessage(
            @Field("groupid") long groupId,
            @Field("text") String text);

}
