package com.emoon.modules.chat.controller;

import com.emoon.chat.service.IHardwareInfoService;
import com.emoon.chat.service.impl.HardwareInfoServiceImpl;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/sys")
public class HardwareInfoController {
    @Resource
    private IHardwareInfoService hardwareInfoService;

    @GetMapping("/hardwareInfo")
    @ResponseBody
    public Map<String, Object> getHardwareInfo() {
        HardwareInfoServiceImpl.HardwareData data = hardwareInfoService.getHardwareData();

        List<HardwareInfoServiceImpl.HardwareData> list = Collections.singletonList(data);

        Map<String, Object> response = new HashMap<>();
        response.put("code", 200);
        response.put("msg", "查询成功");
        response.put("rows", list);

        return response;
    }
}
