package com.sckw.payment.controller.operate;

import com.sckw.core.web.response.HttpResult;
import com.sckw.payment.model.constant.SettlementOrderTypeEnum;
import com.sckw.payment.model.constant.SettlementWalletPayTypeEnum;
import com.sckw.payment.model.vo.req.SettlementWalletReq;
import com.sckw.payment.service.operate.SettlementWalletService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 结算-电子钱包结算记录（交易订单结算/物流订单结算）
 *
 * @author xucaiqin
 * @date 2023-07-20 14:42
 */
@Validated
@RestController
@RequestMapping("/settlementWallet")
public class SettlementWalletController {
    @Resource
    private SettlementWalletService settlementWalletService;

    /**
     * 货到付款-物流
     *
     * @param settlementWalletReq
     * @return
     */
    @GetMapping("logisticsList")
    public HttpResult logisticsList(@Valid SettlementWalletReq settlementWalletReq) {
        settlementWalletReq.setPayType(SettlementWalletPayTypeEnum.CASH_ON_DELIVERY.getStatus());
        settlementWalletReq.setOrderType(SettlementOrderTypeEnum.LOGISTICS.getStatus());
        return HttpResult.ok(settlementWalletService.pageList(settlementWalletReq));
    }

    /**
     * 货到付款-贸易
     *
     * @param settlementWalletReq
     * @return
     */
    @GetMapping("tradeList")
    public HttpResult tradeList(@Valid SettlementWalletReq settlementWalletReq) {
        settlementWalletReq.setPayType(SettlementWalletPayTypeEnum.CASH_ON_DELIVERY.getStatus());
        settlementWalletReq.setOrderType(SettlementOrderTypeEnum.TRADE.getStatus());
        return HttpResult.ok(settlementWalletService.pageList(settlementWalletReq));
    }

    /**
     * 预付款-贸易
     * 没有预付款-物流这种情况
     *
     * @param settlementWalletReq
     * @return
     */
    @GetMapping( "tradePreList")
    public HttpResult tradePreList(@Valid SettlementWalletReq settlementWalletReq) {
        settlementWalletReq.setPayType(SettlementWalletPayTypeEnum.ADVANCE_PAYMENT.getStatus());
        settlementWalletReq.setOrderType(SettlementOrderTypeEnum.TRADE.getStatus());
        return HttpResult.ok(settlementWalletService.pageList(settlementWalletReq));
    }

}
