package cn.reghao.bnt.web.devops.machine.service;

import cn.reghao.bnt.common.machine.*;
import cn.reghao.bnt.common.machine.model.CPUInfo;
import cn.reghao.bnt.common.machine.model.DiskInfo;
import cn.reghao.bnt.common.machine.model.MemoryInfo;
import cn.reghao.bnt.common.machine.model.NetworkCard;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author reghao
 * @date 2025-09-26 17:34:58
 */
@Service
public class MachineSys {
    private CPU cpu;
    private Memory memory;
    private Disk disk;
    private Network network;
    private OS os;

    public MachineSys(CPU cpu, Memory memory, Disk disk, Network network, OS os) {
        this.cpu = cpu;
        this.memory = memory;
        this.disk = disk;
        this.network = network;
        this.os = os;
    }

    public void get() {
        CPUInfo cpuInfo = cpu.getCPUInfo();
        MemoryInfo memoryInfo = memory.getMemoryInfo();
        List<DiskInfo> diskInfoList = disk.getDisks();
        List<NetworkCard> networkCardList = network.getNetworkCards();
    }

    public CPUInfo getCPUInfo() {
        CPUInfo cpuInfo = cpu.getCPUInfo();
        return cpuInfo;
    }

    public MemoryInfo getMemoryInfo() {
        MemoryInfo memoryInfo = memory.getMemoryInfo();
        return memoryInfo;
    }

    public List<DiskInfo> getDiskList() {
        List<DiskInfo> diskInfoList = disk.getDisks();
        return diskInfoList;
    }

    public List<NetworkCard> getNetworkCardList() {
        List<NetworkCard> networkCardList = network.getNetworkCards();
        return networkCardList;
    }

    public void getOSInfo() {
        os.detail();
    }
}
