package com.cool.store.controller.webb;

import com.cool.store.request.bigdata.ProfitDataRequest;
import com.cool.store.request.oppty.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.bigdata.ProfitDataResponse;
import com.cool.store.response.oppty.CityResponse;
import com.cool.store.response.oppty.OpportunityDetailResponse;
import com.cool.store.response.oppty.OpportunityInfoPageResponse;
import com.cool.store.service.ThirdOpportunityService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @Author suzhuhong
 * @Date 2025/4/2 19:48
 * @Version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/pc/third/api")
public class PCThirdApiController {

    @Resource
    ThirdOpportunityService thirdOpportunityService;

    @PostMapping("/list")
    @ApiOperation("PC 机会点列表/我的机会点")
    public ResponseResult<OpportunityInfoPageResponse> listOpportunities(@Valid @RequestBody OpportunityListRequest request) {
        return ResponseResult.success(thirdOpportunityService.listOpportunities(request));
    }

    @PostMapping("/cityList")
    @ApiOperation("省市区列表 查询省传0")
    public ResponseResult<List<CityResponse>> listOpportunities(@Valid @RequestBody CityRequest request) {
        // 调用第三方接口
        return ResponseResult.success(thirdOpportunityService.cityList(request));
    }

    @PostMapping("/getOpportunitiesDetail")
    @ApiOperation("机会点详情")
    public ResponseResult<OpportunityDetailResponse> getOpportunitiesDetail(@Valid @RequestBody OpportunityDetailRequest request) {
        return ResponseResult.success(thirdOpportunityService.getOpportunitiesDetail(request));
    }

    @PostMapping("/followOpportunity")
    @ApiOperation("关注/取消关注 机会点")
    public ResponseResult<String> followOpportunity(@Valid @RequestBody FollowRequest request) {
        return ResponseResult.success(thirdOpportunityService.followOpportunity(request));
    }

    @PostMapping("/inspectionOpportunity")
    @ApiOperation("考察机会点")
    public ResponseResult<String> inspectionOpportunity(@Valid @RequestBody InspectionRequest request) {
        return ResponseResult.success(thirdOpportunityService.inspectionOpportunity(request));
    }


    @PostMapping("/berthOperation")
    @ApiOperation("铺位关注机会点")
    public ResponseResult<String> berthOperation(@Valid @RequestBody BerthOperationRequest request) {
        return ResponseResult.success(thirdOpportunityService.berthOperation(request));
    }

    @PostMapping("/storeOperation")
    @ApiOperation("门店关注机会点")
    public ResponseResult<String> storeOperation(@Valid @RequestBody StoreOperationRequest request) {
        return ResponseResult.success(thirdOpportunityService.storeOperation(request));
    }

}
