package com.yidian.shenghuoquan.border.http

import com.yidian.bcommon.http.HttpResult
import io.reactivex.rxjava3.core.Observable
import okhttp3.RequestBody
import org.json.JSONObject
import retrofit2.http.*

/**
 * author: yinjiacheng
 * date: 2021/8/23 11:02
 * description: 订单组件API定义
 */
interface OrderApiService {

  private companion object {
    const val getOrderDetail = "/order/order/order_info"
    const val applyRefund = "/order/order/refund_apply"
    const val orderConfirm = "/order/order/order_confirm_page"
    const val createOrder = "/order/order/create"
    const val orderPay = "/pay/order/pay"
    const val getPickupPointList = "/marketing/wxapp/get_bind_take_place_list"
  }

  /**
   * 2003 获取订单详情
   */
  @POST(getOrderDetail)
  @Headers("Content-Type: application/json")
  fun getOrderDetail(
    @QueryMap commonParams: Map<String, String>,
    @Body requestParams: Map<String, String?>
  ): Observable<HttpResult<Any?>>

  /**
   * 2006 申请退款
   */
  @POST(applyRefund)
  @Headers("Content-Type: application/json")
  fun applyRefund(
    @QueryMap commonParams: Map<String, String>,
    @Body requestParams: Map<String, String?>
  ): Observable<HttpResult<Any?>>

  /**
   * 2013 获取订单确认页
   */
  @POST(orderConfirm)
  @Headers("Content-Type: application/json")
  fun requestOrderConfirm(
    @QueryMap commonParams: Map<String, String>,
    @Body body: RequestBody
  ): Observable<HttpResult<Any?>>

  /**
   * 2004 创建订单
   */
  @POST(createOrder)
  @Headers("Content-Type: application/json")
  fun requestCreateOrder(
    @QueryMap commonParams: Map<String, String>,
    @Body body: RequestBody
  ): Observable<HttpResult<Any?>>

  /**
   * 7014 订单支付
   */
  @POST(orderPay)
  @Headers("Content-Type: application/json")
  fun requestOrderPay(
    @QueryMap commonParams: Map<String, String>,
    @Body requestParams: Map<String, String?>
  ): Observable<HttpResult<Any?>>

  /**
   * 获取活动设置的自提点列表
   */
  @GET(getPickupPointList)
  fun getPickupPointList(
    @QueryMap commonParams: Map<String, String>,
    @QueryMap requestParams: Map<String, String?>
  ): Observable<HttpResult<Any?>>

}
