package com.haha.admin.controller;

import com.haha.admin.annotation.RequirePermission;
import com.haha.common.vo.Result;
import com.haha.service.HahaCallbackService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 哈哈平台回调管理控制器
 */
@Slf4j
@RestController
@RequestMapping("/callback")
@RequiredArgsConstructor
public class CallbackController {

    private final HahaCallbackService hahaCallbackService;

    /**
     * 查询回调投递状态
     * @param type 识别类型：REC识别结果回调，ORDER订单结果回调
     * @param actId 活动编号
     * @return 回调状态信息
     */
    @RequirePermission("order:read")
    @GetMapping("/info")
    public Result<Map<String, Object>> getCallbackInfo(@RequestParam String type,
                                                        @RequestParam String actId) {
        Map<String, Object> result = hahaCallbackService.getCallbackInfo(type, actId);
        return Result.success("查询成功", result);
    }
}
