package shop.alien.store.controller;

import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import shop.alien.entity.result.R;
import shop.alien.entity.store.vo.StoreCashOutRecordVo;
import shop.alien.store.service.StoreCashOutRecordService;

import java.util.Date;

/**
 * 商户提现记录表 前端控制器
 *
 * @author ssk
 * @since 2025-02-25
 */
@Slf4j
@Api(tags = {"商户提现记录"})
@ApiSort(15)
@CrossOrigin
@RestController
@RequestMapping("/storeCashOutRecord")
@RequiredArgsConstructor
public class StoreCashOutRecordController {

    private final StoreCashOutRecordService storeCashOutRecordService;

    @ApiOperation("提现记录列表")
    @ApiOperationSupport(order = 1)
    @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "storeId", value = "商家id", dataType = "Integer", paramType = "query", required = true),
            @ApiImplicitParam(name = "cashOutStartTime", value = "提现开始时间", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "cashOutEndTime", value = "提现结束时间", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "paymentStatus", value = "提现状态", dataType = "Integer", paramType = "query")
    })
    @GetMapping("/getCashOutRecordList")
    public R<StoreCashOutRecordVo> getCashOutRecordList(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size, Integer storeId,
                                                        @DateTimeFormat(pattern = "yyyy-MM-dd 00:00:00") String cashOutStartTime,
                                                        @DateTimeFormat(pattern = "yyyy-MM-dd 23:59:59") String cashOutEndTime,
                                                        String paymentStatus) {
        return R.data(storeCashOutRecordService.getCashOutRecordList(storeId, cashOutStartTime, cashOutEndTime,page,size,paymentStatus));
    }

    @ApiOperation("提现详情")
    @ApiOperationSupport(order = 2)
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "主键id", dataType = "Integer", paramType = "query")})
    @GetMapping("/getCashOutRecordById")
    public R<StoreCashOutRecordVo> getCashOutRecordById(Integer id) {
        return R.data(storeCashOutRecordService.getCashOutRecordById(id));
    }


    //可提现金额

    //已到账期

    //到期弹窗

    //提现记录

    //提现详情

    //提现进度

    //

}
