package com.sqx.modules.shop.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.service.UserMoneyService;
import com.sqx.modules.sys.controller.AbstractController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@Api(tags={"商户端-商户钱包"})
@RestController
@RequestMapping("admin/shop/money")
@RequiredArgsConstructor
public class AdminShopMoneyController extends AbstractController {

    private final UserMoneyService userMoneyService;

    @ApiOperation("店铺分账")
    @PutMapping(value = "split-bill/{shopId}/{amount}")
    public Result splitBill(@PathVariable Long shopId, @PathVariable BigDecimal amount) {
        userMoneyService.splitBill(shopId, amount);
        return Result.success();
    }
}
