package com.tashow.cloud.app.controller;

import com.tashow.cloud.app.mq.annotation.BuriedPoint;
import com.tashow.cloud.app.mq.mapper.BuriedPointMapper;
import com.tashow.cloud.app.mq.message.BuriedMessages;
import com.tashow.cloud.app.mq.producer.buriedPoint.BuriedPointProducer;
import jakarta.annotation.security.PermitAll;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 测试控制器
 */
@RestController
@RequiredArgsConstructor
public class TestController {
    
    private final BuriedPointProducer buriedPointProducer;
    private final BuriedPointMapper buriedPointMapper;
    
    /**
     * 基础测试接口
     */
    @GetMapping("/test")
    @PermitAll
    public String test() {
        return "test";
    }
    
    /**
     * 测试埋点拦截器
     * 这个接口会被埋点拦截器自动记录请求信息
     */
    @GetMapping("/test/buried-point")
    @PermitAll
    public Map<String, Object> testBuriedPoint() {
        Map<String, Object> result = new HashMap<>();
        result.put("success", true);
        result.put("message", "埋点拦截器测试成功");
        return result;
    }

}
