package shop.alien.store.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import shop.alien.entity.result.R;
import shop.alien.store.service.StoreCommentAppealSupplementJobService;

/**
 * 评论申诉-用户补充定时任务测试接口（仅启动 alien-store 即可联调）
 */
@Slf4j
@Api(tags = "评论申诉用户补充-定时任务测试")
@RestController
@RequestMapping("/storeCommentAppealSupplementJob/test")
@RequiredArgsConstructor
public class StoreCommentAppealSupplementJobTestController {

    private final StoreCommentAppealSupplementJobService supplementJobService;

    @ApiOperation("手动触发：提交申诉AI分析")
    @PostMapping("/triggerAppealAnalyze")
    public R<String> triggerAppealAnalyze() {
        log.info("StoreCommentAppealSupplementJobTestController.triggerAppealAnalyze");
        return supplementJobService.submitAppealAnalyze();
    }

    @ApiOperation("手动触发：轮询申诉AI分析结果")
    @PostMapping("/triggerCompletedResult")
    public R<String> triggerCompletedResult() {
        log.info("StoreCommentAppealSupplementJobTestController.triggerCompletedResult");
        return supplementJobService.pollCompletedResult();
    }
}
