package com.bocloud.cmp.model.hmc;

import java.util.List;
import java.util.stream.Collectors;

public class HmdServerVirtualSwitchModel extends HmdGenericModel {
    private String name; // 名称
    private String status; // 状态
    private Integer switchId; // 交换机id
    private HmdServerModel server; // 所属服务器
    private List<HmdServerVirtualNetworkModel> virtualNetworks; // 连接的虚拟网络

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getSwitchId() {
        return switchId;
    }

    public void setSwitchId(Integer switchId) {
        this.switchId = switchId;
    }

    public List<HmdServerVirtualNetworkModel> getVirtualNetworks() {
        return virtualNetworks;
    }

    public void setVirtualNetworks(List<HmdServerVirtualNetworkModel> virtualNetworks) {
        this.virtualNetworks = virtualNetworks;
    }

    public void setVirtualNetworkUrls(List<String> urls) {
        this.virtualNetworks = urls.stream().map(url -> {
            HmdServerVirtualNetworkModel network = new HmdServerVirtualNetworkModel();
            network.setUrl(url);
            return network;
        }).collect(Collectors.toList());
    }

    public HmdServerModel getServer() {
        return server;
    }

    public void setServer(HmdServerModel server) {
        this.server = server;
    }
}
