package cn.iocoder.yudao.module.member.controller.app.rechargeamount;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.member.controller.app.rechargeamount.vo.AppRechargeAmountRespVO;
import cn.iocoder.yudao.module.member.dal.dataobject.rechargeamount.RechargeAmountDO;
import cn.iocoder.yudao.module.member.service.rechargeamount.RechargeAmountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
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 java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 App - 充值金额配置")
@RestController
@RequestMapping("/member/recharge-amount")
@Validated
public class AppRechargeAmountController {

    @Resource
    private RechargeAmountService rechargeAmountService;

    //@PostMapping("/create")
    //@Operation(summary = "创建充值金额配置")
    //@PreAuthorize("@ss.hasPermission('member:recharge-amount:create')")
    //public CommonResult<Long> createRechargeAmount(@Valid @RequestBody AppRechargeAmountSaveReqVO createReqVO) {
    //    return success(rechargeAmountService.createRechargeAmount(createReqVO));
    //}
    //
    //@PutMapping("/update")
    //@Operation(summary = "更新充值金额配置")
    //@PreAuthorize("@ss.hasPermission('member:recharge-amount:update')")
    //public CommonResult<Boolean> updateRechargeAmount(@Valid @RequestBody AppRechargeAmountSaveReqVO updateReqVO) {
    //    rechargeAmountService.updateRechargeAmount(updateReqVO);
    //    return success(true);
    //}
    //
    //@DeleteMapping("/delete")
    //@Operation(summary = "删除充值金额配置")
    //@Parameter(name = "id", description = "编号", required = true)
    //@PreAuthorize("@ss.hasPermission('member:recharge-amount:delete')")
    //public CommonResult<Boolean> deleteRechargeAmount(@RequestParam("id") Long id) {
    //    rechargeAmountService.deleteRechargeAmount(id);
    //    return success(true);
    //}
    //
    //@GetMapping("/get")
    //@Operation(summary = "获得充值金额配置")
    //@Parameter(name = "id", description = "编号", required = true, example = "1024")
    //@PreAuthorize("@ss.hasPermission('member:recharge-amount:query')")
    //public CommonResult<AppRechargeAmountRespVO> getRechargeAmount(@RequestParam("id") Long id) {
    //    RechargeAmountDO rechargeAmount = rechargeAmountService.getRechargeAmount(id);
    //    return success(BeanUtils.toBean(rechargeAmount, AppRechargeAmountRespVO.class));
    //}
    //
    @GetMapping("/page")
    @Operation(summary = "获得充值金额")
    public CommonResult<List<AppRechargeAmountRespVO>> getRechargeAmountPage() {
        List<RechargeAmountDO> amount = rechargeAmountService.getAmount();
        return success(BeanUtils.toBean(amount, AppRechargeAmountRespVO.class));
    }
    //
    //@GetMapping("/export-excel")
    //@Operation(summary = "导出充值金额配置 Excel")
    //@PreAuthorize("@ss.hasPermission('member:recharge-amount:export')")
    //@OperateLog(type = EXPORT)
    //public void exportRechargeAmountExcel(@Valid AppRechargeAmountPageReqVO pageReqVO,
    //          HttpServletResponse response) throws IOException {
    //    pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
    //    List<RechargeAmountDO> list = rechargeAmountService.getRechargeAmountPage(pageReqVO).getList();
    //    // 导出 Excel
    //    ExcelUtils.write(response, "充值金额配置.xls", "数据", AppRechargeAmountRespVO.class,
    //                    BeanUtils.toBean(list, AppRechargeAmountRespVO.class));
    //}

}