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

import com.bonus.canteen.core.common.constant.NuclearModeEnum;
import com.bonus.canteen.core.order.common.constants.CheckStateEnum;
import com.bonus.canteen.core.order.common.constants.OrderStateEnum;
import com.bonus.canteen.core.order.common.constants.OrderStateMixEnum;
import com.bonus.canteen.core.order.common.constants.OrderTypeEnum;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.houqin.constant.SourceTypeEnum;
import com.bonus.canteen.core.order.common.vo.OrderEnumVO;
import com.bonus.canteen.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);
   }

   @PostMapping({"/type-list"})
   @ApiOperation("订单类型")
   public AjaxResult getOrderTypeEnumList() {
      List<Map<String, Object>> allEnumsList = OrderTypeEnum.getAllEnumsList();
      return AjaxResult.success(OrderEnumVO.listOf(allEnumsList));
   }

   @PostMapping({"/state-mix-list"})
   @ApiOperation("订单状态（混合版）")
   public AjaxResult getOrderStateMixEnumList() {
      List<Map<String, Object>> allEnumsList = OrderStateMixEnum.getAllEnumsList();
      return AjaxResult.success(OrderEnumVO.listOf(allEnumsList));
   }

   @PostMapping({"/nuclear/mode-list"})
   @ApiOperation("核身方式")
   public AjaxResult getNuclearModeEnumList() {
      List<Map<String, Object>> allEnumsList = NuclearModeEnum.getAllEnumsList();
      return AjaxResult.success(OrderEnumVO.listOf(allEnumsList));
   }

   @PostMapping({"/state-list"})
   @ApiOperation("订单状态")
   public AjaxResult getOrderStateEnumList() {
      List<Map<String, Object>> allEnumsList = OrderStateEnum.getAllEnumsList();
      return AjaxResult.success(OrderEnumVO.listOf(allEnumsList));
   }

   @PostMapping({"/check/state-list"})
   @ApiOperation("审核状态")
   public AjaxResult getCheckStateEnumList() {
      List<Map<String, Object>> allEnumsList = CheckStateEnum.getAllEnumsList();
      return AjaxResult.success(OrderEnumVO.listOf(allEnumsList));
   }
}
