package com.m2pool.lease.controller;


import com.m2pool.lease.annotation.Decrypt;
import com.m2pool.lease.annotation.LedgerLog;
import com.m2pool.lease.annotation.LoginRequired;
import com.m2pool.lease.dto.PageResult;
import com.m2pool.lease.dto.Result;
import com.m2pool.lease.dto.v2.PayWithdrawSellerRecordDto;
import com.m2pool.lease.dto.v2.ShopWalletInfoDto;
import com.m2pool.lease.service.LeaseShopService;
import com.m2pool.lease.vo.BalanceVo;
import com.m2pool.lease.vo.BaseVo;
import com.m2pool.lease.vo.PageVo;
import com.m2pool.lease.vo.v2.ShopWalletInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * <p>
 * 店铺表 前端控制器
 * </p>
 *
 * @author yyb
 * @since 2025-08-05
 */
@Api(tags = "v2版本--店铺控制器")
@LoginRequired
@RestController
@RequestMapping("/v2/shop")
public class LeaseShopV2Controller {

    @Resource
    private LeaseShopService leaseShopService;

    /**
     * 根据店铺id 查询配置信息列表
     * @param baseVo
     * @return 操作结果
     */
    @ApiOperation("钱包配置----根据店铺id查询收款钱包绑定信息列表")
    @PostMapping("/getShopConfigV2")
    public Result<List<ShopWalletInfoDto>> getShopConfigV2(@RequestBody BaseVo baseVo) {
        return leaseShopService.getShopConfigV2(baseVo);
    }

    @LedgerLog(value = "卖家钱包--余额提现申请")
    @Decrypt
    @PostMapping("/withdrawBalanceForSeller")
    @ApiOperation(value = "卖家店铺钱包余额提现")
    public Result<String> withdrawBalanceForSeller(@RequestBody BalanceVo balanceVo){
        return leaseShopService.withdrawBalanceForSeller(balanceVo);
    }

    @ApiOperation("钱包配置----根据配置id 修改商铺收款钱包配置")
    @PostMapping("/updateShopConfigV2")
    @Decrypt
    public Result<String> updateShopConfigV2(@RequestBody ShopWalletInfoVo shopWalletInfoVo) {
        return leaseShopService.updateShopConfigV2(shopWalletInfoVo);
    }


    @PostMapping("/balanceWithdrawList")
    @ApiOperation(value = "卖家：余额提现记录列表")
    public PageResult<PayWithdrawSellerRecordDto> balanceWithdrawList(@RequestBody PageVo pageVo){
        return leaseShopService.balanceWithdrawList(pageVo);
    }



}

