package kr.co.vividnext.sodalive.explorer

import io.reactivex.rxjava3.core.Flowable
import io.reactivex.rxjava3.core.Single
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.explorer.profile.GetCheersResponse
import kr.co.vividnext.sodalive.explorer.profile.GetCreatorProfileResponse
import kr.co.vividnext.sodalive.explorer.profile.PostCreatorNoticeRequest
import kr.co.vividnext.sodalive.explorer.profile.cheers.PostWriteCheersRequest
import kr.co.vividnext.sodalive.explorer.profile.cheers.PutModifyCheersRequest
import kr.co.vividnext.sodalive.explorer.profile.donation.GetDonationAllResponse
import kr.co.vividnext.sodalive.explorer.profile.follow.GetFollowerListResponse
import kr.co.vividnext.sodalive.live.room.detail.GetRoomDetailUser
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface ExplorerApi {
    @GET("/explorer")
    fun getExplorer(
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<GetExplorerResponse>>

    @GET("/explorer/search/channel")
    fun searchChannel(
        @Query("channel") channel: String,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<List<GetRoomDetailUser>>>

    @GET("/explorer/profile/{id}")
    fun getCreatorProfile(
        @Path("id") id: Long,
        @Query("timezone") timezone: String,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<GetCreatorProfileResponse>>

    @GET("/explorer/profile/{id}/donation-rank")
    fun getCreatorProfileDonationRanking(
        @Path("id") id: Long,
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<GetDonationAllResponse>>

    @GET("/explorer/profile/{id}/cheers")
    fun getCreatorProfileCheers(
        @Path("id") creatorId: Long,
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("timezone") timezone: String,
        @Header("Authorization") authHeader: String
    ): Flowable<ApiResponse<GetCheersResponse>>

    @POST("/explorer/profile/cheers")
    fun writeCheers(
        @Body request: PostWriteCheersRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<Any>>

    @PUT("/explorer/profile/cheers")
    fun modifyCheers(
        @Body request: PutModifyCheersRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<Any>>

    @POST("/explorer/profile/notice")
    fun writeCreatorNotice(
        @Body request: PostCreatorNoticeRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<Any>>

    @GET("/explorer/profile/{id}/follower-list")
    fun getFollowerList(
        @Path("id") userId: Long,
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<GetFollowerListResponse>>
}
