package com.red.circle.console.adapter.app.order;

import com.red.circle.console.app.dto.clienobject.order.InAppPurchaseDetailsCO;
import com.red.circle.console.app.service.app.order.InAppPurchaseBackService;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.order.inner.model.cmd.inapp.InAppPurchaseDetailsQryCmd;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单详情列表
 *
 * @author pengliang on 2022/10/31
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/order/in-app-purchase")
public class InAppPurchaseRestController extends BaseController {

  private final InAppPurchaseBackService inAppPurchaseBackService;

  /**
   * 指定订单详情.
   */
  @GetMapping("/details")
  public InAppPurchaseDetailsCO compensateOrder(@RequestParam String id) {
    return inAppPurchaseBackService.getDetails(id);
  }

  /**
   * 订单详情列表.
   */
  @GetMapping("/details/list")
  public List<InAppPurchaseDetailsCO> listDetails(InAppPurchaseDetailsQryCmd query) {
    return inAppPurchaseBackService.listDetails(query);
  }

  /**
   * 订单统计查询 - 返回金额总数和订单总数
   */
  @GetMapping("/statistics")
  public Map<String, Object> statistics(InAppPurchaseDetailsQryCmd query) {
    return inAppPurchaseBackService.statistics(query);
  }

}
