package cn.reghao.devops.mgr.machine.model.vo;

import cn.reghao.devops.mgr.machine.model.po.DiskInfo;
import cn.reghao.devops.mgr.machine.model.po.MachineInfo;
import cn.reghao.devops.mgr.machine.model.po.NetworkInfo;
import cn.reghao.jutil.jdk.converter.DateTimeConverter;
import lombok.Data;

import java.util.List;

/**
 * @author reghao
 * @date 2020-12-25 17:53:15
 */
@Data
public class MachineInfoVO {
    private String machineId;
    private String machineIpv4;

    private String arch;
    private String name;
    // 系统版本或内核版本
    private String version;
    private String byteOrder;
    private String bootTime;

    private String vendor;
    private String modelName;
    private int physicalCore;
    private int logicalCore;

    private String memTotal;
    private String swapTotal;
    private List<NetworkInfo> networkInfos;
    private List<DiskInfo> diskInfos;

    public MachineInfoVO(MachineInfo machineInfo) {
        this.machineId = machineInfo.getMachineId();
        this.machineIpv4 = machineInfo.getMachineIpv4();

        this.arch = machineInfo.getArch();
        this.name = machineInfo.getName();
        this.version = machineInfo.getVersion();
        this.byteOrder = machineInfo.getByteOrder();
        this.bootTime = DateTimeConverter.format(machineInfo.getBootTime()*1000);
        this.networkInfos = machineInfo.getNetworkInfos();
        this.diskInfos = machineInfo.getDiskInfos();
    }
}
