package com.yidian.shenghuoquan.border.http

import com.yidian.bcommon.http.HttpResult
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.QueryMap

/**
 * 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"
  }

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

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

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

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

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

}
