package com.cool.store.controller.webc;

import com.cool.store.context.PartnerUserHolder;
import com.cool.store.enums.PlatformBuildEnum;
import com.cool.store.request.PlatformBuildRequest;
import com.cool.store.response.PlatformBuildResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.PlatformBuildService;
import com.cool.store.vo.PartnerUserInfoVO;
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/10/下午3:58
 * @Version 1.0
 * @注释:
 */
@Api("mini平台建店")
@RestController
@RequestMapping("/mini/platformBuild")
public class MiniPlatformBuildController {

    @Resource
    private PlatformBuildService platformBuildService;

    @ApiOperation("获取是法人身份证号")
    @GetMapping("/getJuridicalIdCard")
    public ResponseResult<String> getJuridicalIdCard(@RequestParam("shopId") Long shopId) {
        return ResponseResult.success(platformBuildService.juridicalIdCard(shopId));
    }
    @ApiOperation("根据type获取平台建店详情:1-抖音，2-快手，3-美团团购，4-饿了么，5-美团外卖")
    @GetMapping("/get")
    public ResponseResult<PlatformBuildResponse> get(@RequestParam("shopId") Long shopId,@RequestParam("type") Integer type) {
        return ResponseResult.success(platformBuildService.get(shopId, type));
    }

    @ApiOperation("根据type 提交或修改 平台建店详情:1-抖音，2-快手，3-美团团购，4-饿了么，5-美团外卖")
    @PostMapping("/submitOrUpdate")
    public ResponseResult<Integer> submitOrUpdate(@RequestBody @Validated PlatformBuildRequest request) {
        return ResponseResult.success(platformBuildService.submitOrUpdate(request, PartnerUserHolder.getUser()));
    }



}
