package com.cool.store.controller.webb;

import com.cool.store.dto.FoodTokenDTO;
import com.cool.store.dto.GetAccessTokenDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.PushService;
import com.cool.store.service.ThirdFoodService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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;

/**
 * @Author suzhuhong
 * @Date 2025/11/24 16:50
 * @Version 1.0
 */
@RestController
@RequestMapping("/pc/token")
@Api(tags = "第三方平台token")
@Slf4j
public class AccountTokenController {


    @Resource
    PushService pushService;

    @Resource
    ThirdFoodService thirdFoodService;

    @ApiOperation("获取云流水免登token")
    @PostMapping("/getYlsToken")
    public ResponseResult<String> getYlsToken(@RequestBody @Validated GetAccessTokenDTO dto) {
        return ResponseResult.success(pushService.getYlsToken(dto));
    }

    @ApiOperation("获取POS免登token")
    @PostMapping("/getPosToken")
    public ResponseResult<String> getPosToken(@RequestBody @Validated GetAccessTokenDTO dto) {
        return ResponseResult.success(pushService.getPosToken(dto));
    }

    @ApiOperation("获取新掌柜免登token")
    @PostMapping("/getXzgToken")
    public ResponseResult<String> getXzgToken(@RequestBody @Validated GetAccessTokenDTO dto) {
        return ResponseResult.success(pushService.getXzgToken(dto));
    }

    @ApiOperation("获取菜品市场token")
    @PostMapping("/getFoodToken")
    public ResponseResult<String> getFoodToken(@RequestBody @Validated FoodTokenDTO dto) {
        return ResponseResult.success(thirdFoodService.getFoodToken(dto));
    }

}
