package com.cool.store.controller.webc;

import com.cool.store.request.BuildInformationRequest;
import com.cool.store.response.BuildInformationResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.BuildInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: WangShuo
 * @Date: 2024/10/09/下午4:08
 * @Version 1.0
 * @注释:
 */
@Api("mini建店资料")
@RestController
@RequestMapping("/mini/buildInformation")
public class MiniBuildInformationController {
    @Resource
    private BuildInformationService buildInformationService;

    @ApiOperation("获取详情")
    @GetMapping("/get")
    public ResponseResult<BuildInformationResponse> getBuildInformation(@RequestParam(value = "shopId", required = true) Long shopId) {
        return ResponseResult.success(buildInformationService.getBuildInformation(shopId));
    }

    @ApiOperation("提交/修改")
    @PostMapping("/submitOrUpdate")
    public ResponseResult<Integer> submitBuildInformation(@RequestBody @Validated BuildInformationRequest request) {
        return ResponseResult.success(buildInformationService.submitOrUpdate(request));
    }

    @ApiOperation("获取加盟类型 1 - 个人加盟 2- 企业加盟")
    @GetMapping("/getJoinType")
    public ResponseResult<Integer> getJoinType(@RequestParam(value = "lineId", required = true) Long lineId) {
        return ResponseResult.success(buildInformationService.getJoinType(lineId));
    }

}
