#include "include.h"
Napi::Array disk_name(const Napi::CallbackInfo& info){
        Napi::Env env = info.Env();
    Napi::Array array;
    int i=0;
    for (Hardware hardware:computer->getHardware()){
        if(hardware.getHardwareType()==HardwareType::Storage){
            Napi::String str2= Napi::String::New(env,hardware.Name());
            array.Set(i, str2);
            i++;
        }
    }
    return array;
}
Napi::Array current_disk_used(const Napi::CallbackInfo& info){
    Napi::Env env = info.Env();
    Napi::Array myarray=Napi::Array::New(env);
    std::vector<Hardware> hardwares=computer->getHardware();
    for (int i=0;i<hardwares.size();i++){
        if(hardwares[i].getHardwareType()==HardwareType::Storage){
            Napi::Object object=Napi::Object::New(env);
            std::string name_str=hardwares[i].Name();
            for(Sensor sen:hardwares[i].getSensors()){
                if(sen.getType()==SensorType::Load && name_str=="Used Space"){
                    myarray.Set<float>(i, sen.getValue()); 
                }
            }
        }
    }
    return myarray;   
}