package com.emotion.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 健康检查控制器
 * 
 * @author huazhongmin
 * @date 2025-07-23
 */
@RestController
public class HealthController {

    private static final Logger log = LoggerFactory.getLogger(HealthController.class);

    /**
     * 健康检查
     */
    @GetMapping("/health")
    public Map<String, Object> health() {
        log.info("健康检查请求");
        
        Map<String, Object> response = new HashMap<>();
        response.put("service", "backend-single");
        response.put("message", "情感博物馆单体服务运行正常");
        response.put("version", "1.0.0");
        response.put("status", "UP");
        response.put("timestamp", LocalDateTime.now());
        
        return response;
    }

    /**
     * 服务信息
     */
    @GetMapping("/health/info")
    public Map<String, Object> info() {
        log.info("服务信息请求");
        
        Map<String, Object> response = new HashMap<>();
        response.put("service", "backend-single");
        response.put("description", "情感博物馆单体服务");
        response.put("version", "1.0.0");
        response.put("author", "emotion-museum");
        response.put("buildTime", "2025-07-23");
        response.put("javaVersion", System.getProperty("java.version"));
        response.put("timestamp", LocalDateTime.now());
        
        return response;
    }
}
