package co.yixiang.yshop.module.order.controller.app.rechargepackage;

import co.yixiang.yshop.framework.common.pojo.CommonResult;
import co.yixiang.yshop.module.order.controller.admin.rechargeconfig.vo.RechargeAllConfigVO;
import co.yixiang.yshop.module.order.enums.RechargePackageStatusEnum;
import co.yixiang.yshop.module.order.service.rechargeconfig.RechargeConfigFacade;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;

@Slf4j
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Tag(name = "APP - 充值规则模块")
@RequestMapping("/recharge-package")
public class AppRechargePackageController {

    @Resource
    private RechargeConfigFacade rechargeConfigFacade;

    @GetMapping("/get-all-config")
    @Operation(summary = "获取所有配置")
    public CommonResult<RechargeAllConfigVO> getAllConfig() {
        return success(rechargeConfigFacade.getAllConfig(RechargePackageStatusEnum.OPEN.getStatus()));
    }
}
