package TestingSystem.DVM.DVMPackage;
import Common.Database.DBObject;
import Common.Global;
import GlobalData.Machine.Machine;
import GlobalData.Machine.MachineType;
import GlobalData.User.User;
import TestingSystem.Common.TestingPackage.TestingPackage;

import java.io.File;
public class DVMPackage extends TestingPackage<DVMPackage_json> {
    //---
    public String machine_name = "";
    public String machine_address = "";
    public int machine_port = 22;
    //---
    public String user_name = "";
    public String user_password;
    public String user_workspace;
    //---
    public DVMPackage() {
    }
    @Override
    public Class getJsonClass() {
        return DVMPackage_json.class;
    }
    @Override
    public File getHomeDirectory() {
        return Global.DVMPackagesDirectory;
    }
    public DVMPackage(DVMPackage p) {
        super(p);
        this.SynchronizeFields(p);
    }
    //---
    @Override
    public void SynchronizeFields(DBObject src) {
        super.SynchronizeFields(src);
        DVMPackage tasksPackage = (DVMPackage) src;
        machine_name = tasksPackage.machine_name;
        machine_address = tasksPackage.machine_address;
        machine_port = tasksPackage.machine_port;
        user_name = tasksPackage.user_name;
        user_workspace = tasksPackage.user_workspace;
        user_password = tasksPackage.user_password;
    }
    public Machine getMachine() {
        return new Machine(machine_name, machine_address, machine_port, MachineType.Server);
    }
    public User getUser() {
        return new User(user_name, user_password, user_workspace);
    }
}
