package com.cool.store.controller.webc;

import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.AuditFranchiseFeeRequest;
import com.cool.store.request.FranchiseFeeRequest;
import com.cool.store.response.FranchiseFeeResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.FranchiseFeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/mini/franchiseFee")
@Api(tags = "Mini 加盟费/保证金")
@Slf4j
public class MiniFranchiseFeeController {


    @Resource
    FranchiseFeeService franchiseFeeService;

    @ApiOperation("基本信息提交")
    @PostMapping("/submit")
    public ResponseResult submitLicense(@RequestBody FranchiseFeeRequest request) {
        return ResponseResult.success(franchiseFeeService.submitLicense(request));
    }

    @ApiOperation("基本信息查询")
    @GetMapping("/getDetail")
    public ResponseResult<FranchiseFeeResponse> getDetail(@RequestParam("shopId") Long shopId) {
        return ResponseResult.success(franchiseFeeService.getDetail(shopId));
    }


    @ApiOperation("缴纳加盟费/保证金审核接口")
    @PostMapping("/audit")
    public ResponseResult auditFranchiseFee(@RequestBody AuditFranchiseFeeRequest request) {
        LoginUserInfo user = CurrentUserHolder.getUser();
        return ResponseResult.success(franchiseFeeService.auditFranchiseFee(request,user));
    }

}
