package com.m2pool.lease.controller;


import com.m2pool.common.security.annotation.RequiresLogin;
import com.m2pool.lease.dto.PaymentCallbackDto;
import com.m2pool.lease.dto.PaymentRecordDto;
import com.m2pool.lease.dto.Result;
import com.m2pool.lease.service.LeasePaymentRecordService;
import com.m2pool.lease.vo.CheckPayStatusVo;
import com.m2pool.lease.vo.OrderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 支付记录表 前端控制器
 * </p>
 *
 * @author yyb
 * @since 2025-07-23
 */
@Api(tags = "支付记录控制器")
@RestController
@RequestMapping("/payment/record")
public class LeasePaymentRecordController {

    @Resource
    private LeasePaymentRecordService  leasePaymentRecordService;

    @ApiOperation("根据订单详情信息生成 支付订单 + 根据返回的集合生成多个支付二维码")
    @PostMapping("/addPayOrder")
    @Deprecated
    public Result<List<PaymentRecordDto>> addPayOrder(@RequestBody OrderVo orderVo) {
        return leasePaymentRecordService.addPayOrder(orderVo);
    }


    @ApiOperation("根据订单id找到支付订单")
    @PostMapping("/getPayOrderByOrderId")
    public Result<List<PaymentRecordDto>> getPayOrderByOrderId(@RequestBody OrderVo orderVo) {
        return leasePaymentRecordService.getPayOrderByOrderId(orderVo);
    }


    @ApiOperation("支付回调结果---根据订单id批量校验本次支付是否成功")
    @PostMapping("/paymentCallbackBatch")
    @Deprecated
    public Result<List<PaymentCallbackDto>> paymentCallbackBatch(@RequestBody List<CheckPayStatusVo> checkPayStatusVoList) {
        return leasePaymentRecordService.paymentCallbackBatch(checkPayStatusVoList);
    }

    @ApiOperation("支付回调结果----根据支付id校验支付是否成功")
    @PostMapping("/paymentCallbackByPayId")
    @Deprecated
    public Result<PaymentCallbackDto> paymentCallbackByPayId(@RequestBody CheckPayStatusVo checkPayStatusVo) {
        return leasePaymentRecordService.paymentCallbackByPayId(checkPayStatusVo);
    }


}

