package com.sambath.kunkhmer.remote.service

import com.sambath.kunkhmer.extension.CurrentUserResponse
import com.sambath.kunkhmer.remote.*
import io.reactivex.Single
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.http.*

interface ApiService {

    @POST("/v1/users/login")
    @Headers("No-Authentication: true")
    fun login(@Body loginRequest: LoginRequest): Single<LoginResponse>

    @GET("/v1/match/getAll")
    fun getMatches(): Single<MatchesResponse>

    @GET("/v1/fighter/getAll")
    fun getFighters(): Single<FighterResponse>

    @GET("fighter/image/{imageId}.jpeg")
    fun getFighterImage(@Path("imageId") imageId: String): Single<ResponseBody>

    @GET("/v1/new/getAll")
    fun getNews(): Single<NewsResponse>

    @GET("/v1/highLight/getAll")
    fun getHighlights(): Single<HighlightResponse>

    @GET("/v1/live/getAll")
    fun getLives(): Single<LivesResponse>

    @GET("/v1/event/getAll")
    fun getEvents(): Single<EventResponse>

    @GET("/v1/product/getAll")
    fun getProducts(): Single<ProductResponse>

    @GET("/v1/new/get/{newsId}")
    fun getNewsDetail(@Path("newsId") newsId: String): Single<NewsDetailResponse>

    @POST("/v1/users/get")
    fun getCurrentUser(): Single<CurrentUserResponse>

    @Multipart
    @POST("/v1/new/create")
    fun createNews(@Part("title") title: RequestBody,
                   @Part("desc") desc: RequestBody,
                   @Part file: MultipartBody.Part
    ): Single<CreateNewsResponse>

    @Multipart
    @POST("/v1/new/create")
    fun createNews(@Part("title") title: RequestBody,
                   @Part("desc") desc: RequestBody
    ): Single<CreateNewsResponse>

    @Multipart
    @POST("/v1/product/create")
    fun createProduct(@Part("name") name: RequestBody,
                      @Part("desc") desc: RequestBody,
                      @Part("price") price: RequestBody,
                      @Part file: MultipartBody.Part): Single<CreateProductResponse>
    @Multipart
    @POST("/v1/product/create")
    fun createProduct(@Part("name") name: RequestBody,
                      @Part("desc") desc: RequestBody,
                      @Part("price") price: RequestBody
                      ): Single<CreateProductResponse>

    @Multipart
    @POST("/v1/fighter/create")
    fun createFighter(@Part("name") name: RequestBody,
                      @Part("desc") desc: RequestBody,
                      @Part("weight") price: RequestBody,
                      @Part("high") height: RequestBody,
                      @Part("nationality") nationality: RequestBody,
                      @Part file: MultipartBody.Part): Single<CreateFighterResponse>

    @Multipart
    @POST("/v1/fighter/create")
    fun createFighter(@Part("name") name: RequestBody,
                      @Part("desc") desc: RequestBody,
                      @Part("weight") price: RequestBody,
                      @Part("high") height: RequestBody,
                      @Part("nationality") nationality: RequestBody): Single<CreateFighterResponse>

    @POST("/v1/highLight/create")
    fun createHighlight(@Body createHighlightRequest: CreateHighlightRequest): Single<CreateHighlightResponse>

    @POST("/v1/match/create")
    fun createMatch(@Body createMatchRequest: CreateMatchRequest): Single<CreateMatchResponse>

    @POST("/v1/event/create")
    fun createEvent(@Body createEventRequest: CreateEventRequest): Single<CreateEventResponse>

    @POST("/v1/live/create")
    fun createLives(@Body createLivesRequest: CreateLivesRequest): Single<CreateLivesResponse>
    ///---------------------------------------------------------

    @POST("/v1/api/user/changepassword")
    fun changePassword(@Body changePwd: ChangePwd): Single<ChangePwdResponse>

    @GET("/v1/api/user")
    fun getUser(): Single<UserResponse>

    @GET("/v1/api/channel")
    fun getChannel(): Single<ChannelResponse>

    @GET("/v1/api/weight")
    fun getWeight(): Single<WeightResponse>

    @GET("/v1/api/type")
    fun getBettingType(): Single<BettingTypeResponse>

    @GET("/v1/api/result")
    fun getResult(): Single<ResultsResponse>

    @POST("/v1/api/betting")
    fun createBetting(@Body createBetting: CreateBetting): Single<BettingResponse>

    @GET("/v1/api/betting/current")
    fun getCurrentBetting(): Single<CurrentResponse>

    @GET("/v1/api/betting/today")
    fun getTodayReport(): Single<TodayResponse>

    @GET("/v1/api/button")
    fun getButton(): Single<ButtonResponse>

    @POST("/v1/api/report/deposit")
    fun getReportDeposit(@Body reportBetting: ReportBody): Single<ReportDepositResponse>

    @POST("/v1/api/report/withdraw")
    fun getReportWithdraw(@Body reportBetting: ReportBody): Single<ReportWithdrawResponse>

    @POST("/v1/api/report/betting")
    fun getReportOne(@Body reportBetting: ReportBody): Single<ReportOneResponse>

    @POST("/v1/api/result/filter")
    fun getReportTwo(@Body reportBetting: ReportBody): Single<ReportTwoResponse>

    @GET("/v1/api/report")
    fun getReportThree(): Single<ReportThreeResponse>
}