package com.hanwha.morakmorak.data.remote.api

import com.hanwha.morakmorak.data.remote.model.HomeDetail
import com.hanwha.morakmorak.data.remote.response.PartiesResponse
import io.reactivex.Single
import retrofit2.Response
import retrofit2.http.*

/**
 * Created by aaron on 2019-09-26
 */

interface HomeAPI {
    /**
     * 모임 리스트 조회
     */
    @GET("/api/parties")
    fun parties(@QueryMap params: MutableMap<String, Int>): Single<PartiesResponse>

    /**
     * 모임 상세 조회
     */
    @GET("/api/parties/{id}")
    fun partiesDetail(@Path("id") id: Int): Single<HomeDetail>

    /**
     * 모임 참가 신청
     */
    @POST("/api/participants")
    fun joinParty(@Body params: MutableMap<String, Any>): Single<Map<String, Int>>

    /**
     * 모임 참가 취소
     */
    @HTTP(method = "DELETE", path = "/api/participants", hasBody = true)
    fun cancelJoining(@Body params: MutableMap<String, Any>): Single<Map<String, Int>>

    @POST("/api/parties")
    fun postParty(@Body params: MutableMap<String, Any>): Single<Response<Any>>
}