package kr.co.vividnext.sodalive.mypage.can

import io.reactivex.rxjava3.core.Single
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.mypage.can.charge.iap.GoogleChargeRequest
import kr.co.vividnext.sodalive.mypage.can.charge.pg.CanResponse
import kr.co.vividnext.sodalive.mypage.can.charge.pg.ChargeRequest
import kr.co.vividnext.sodalive.mypage.can.charge.pg.ChargeResponse
import kr.co.vividnext.sodalive.mypage.can.charge.pg.VerifyRequest
import kr.co.vividnext.sodalive.mypage.can.coupon.UseCanCouponRequest
import kr.co.vividnext.sodalive.mypage.can.status.GetCanStatusResponse
import kr.co.vividnext.sodalive.mypage.can.status.charge.GetCanChargeStatusResponseItem
import kr.co.vividnext.sodalive.mypage.can.status.use.GetCanUseStatusResponseItem
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Query

interface CanApi {
    @POST("/charge/google")
    fun googleChargeCan(
        @Body request: GoogleChargeRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<Any>>

    @POST("/charge")
    fun chargeCan(
        @Body chargeRequest: ChargeRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<ChargeResponse>>

    @POST("/charge/verify")
    fun verifyCharge(
        @Body request: VerifyRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<Any>>

    @POST("/charge/verify/hecto")
    fun verifyChargeHecto(
        @Body request: VerifyRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<Any>>

    @GET("/can")
    fun getCans(
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<List<CanResponse>>>

    @GET("/can/status")
    fun getCanStatus(
        @Query("container") container: String = "aos",
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<GetCanStatusResponse>>

    @GET("/can/status/use")
    fun getCanUseStatus(
        @Query("timezone") timezone: String,
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("container") container: String = "aos",
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<List<GetCanUseStatusResponseItem>>>

    @GET("/can/status/charge")
    fun getCanChargeStatus(
        @Query("timezone") timezone: String,
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("container") container: String = "aos",
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<List<GetCanChargeStatusResponseItem>>>

    @POST("/can/coupon/use")
    fun useCanCoupon(
        @Body request: UseCanCouponRequest,
        @Header("Authorization") authHeader: String
    ): Single<ApiResponse<Any>>
}
