package com.cool.store.controller.webc;


import com.cool.store.request.JoinIntentionRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.JoinIntentionService;
import com.cool.store.vo.PartnerBaseInfoVO;
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;
import javax.validation.Valid;

@RestController
@RequestMapping({"/mini/JoinIntention"})
@Slf4j
@Api(tags = "小程序意向加盟")
public class MiniJoinIntentionController {

    @Resource
    private JoinIntentionService joinIntentionService;

    @PostMapping(path = "/submitOrUpdate")
    @ApiOperation("填写或更新加盟意向申请书")
    public ResponseResult<Boolean> submit(@RequestBody @Valid JoinIntentionRequest request) {
        return ResponseResult.success(joinIntentionService.submit(request));
    }

    @GetMapping(path = "/getByLineId")
    @ApiOperation("查找加盟意向申请书")
    public ResponseResult<PartnerBaseInfoVO> getByLineId(@RequestParam("lineId") Long lineId) {
        return ResponseResult.success(joinIntentionService.getByLineId(lineId));
    }

}
