package com.bonus.core.order.common.controller;

import com.bonus.common.core.web.controller.BaseController;
import com.bonus.constant.SourceTypeEnum;
import com.bonus.core.order.common.vo.OrderEnumVO;
import com.bonus.core.pay.common.constants.PayTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping({"/api/v2/order/enums"})
@Api(
   value = "orderEnum",
   tags = {"订单相关枚举"}
)
public class OrderController extends BaseController {
   @PostMapping({"/pay-type-list"})
   @ApiOperation("支付类型")
   public List<OrderEnumVO> getPayTypeEnumList() {
      List<Map<String, Object>> allEnumsList = PayTypeEnum.getAllEnumsList();
      return OrderEnumVO.listOf(allEnumsList);
   }

   @PostMapping({"/source/type-list"})
   @ApiOperation("来源类型")
   public List<OrderEnumVO> getSourceTypeEnumList() {
      List<Map<String, Object>> allEnumsList = SourceTypeEnum.getAllEnumsList();
      return OrderEnumVO.listOf(allEnumsList);
   }
}
