package com.cool.store.controller.webc;

import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.request.JoinIntentionRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.SigningBaseInfoResponse;
import com.cool.store.service.IntentAgreementService;
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/IntentAgreement"})
@Slf4j
@Api(tags = "小程序意向协议")
public class MiniIntentAgreementController {

    @Resource
    IntentAgreementService intentAgreementService;

    @PostMapping(path = "/submit")
    @ApiOperation("签署意向协议")
    public ResponseResult<Boolean> submit(@RequestBody IntentAgreementSubmitRequest request) {
        boolean resp = intentAgreementService.submit(request);
        return ResponseResult.success(resp);
    }

    @GetMapping(path = "/get")
    @ApiOperation("查询意向协议信息")
    public ResponseResult<SigningBaseInfoResponse> getMiniIntentAgreement(
            @RequestParam(value = "partnerId",required = false) String partnerId,
            @RequestParam(value = "lineId",required = false) Long lineId) {
        SigningBaseInfoResponse resp = intentAgreementService.getMiniIntentAgreement(partnerId,lineId);
        return ResponseResult.success(resp);
    }
}
