package com.cool.store.controller.webc;

import com.cool.store.context.PartnerUserHolder;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.LinePayService;
import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author wxp
 * @Date 2024/3/25 13:43
 * @Version 1.0
 */
@RestController
@RequestMapping("/mini/linePay")
@Api(tags = "缴纳意向金")
@Slf4j
public class LinePayController {

    @Resource
    private LinePayService linePayService;

    @ApiOperation("查询意向金详情")
    @GetMapping("/getLinePayInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "lineId", value = "线索id", required = true)
    })
    public ResponseResult<LinePayVO> getLinePayInfo(@RequestParam("lineId")Long lineId) {
        return ResponseResult.success(linePayService.getLinePayInfo(lineId, PayBusinessTypeEnum.INTENT_MONEY.getCode(),null));
    }

    @ApiOperation("缴纳意向金/加盟费")
    @PostMapping("/submitPayInfo")
    public ResponseResult<Long> submitPayInfo(@RequestBody LinePaySubmitRequest request){
        PartnerUserInfoVO partnerUser = PartnerUserHolder.getUser();
        return ResponseResult.success(linePayService.submitPayInfo(request, partnerUser));
    }

}
