package com.bocloud.ims.entity.resource.hmc;

import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.Table;

import java.util.Objects;

@Table("hmd_server_virtual_network")
public class HmdServerVirtualNetwork extends HmdGenericEntity {
    @Column("server_id")
    private Long serverId; // 所属服务器id，对应hmd_server表的id字段
    @Column("uuid")
    private String uuid; // 唯一标识
    @Column("vlan_id")
    private Integer vlanId; // vlanId
    @Column("virtual_switch_id")
    private Long virtualSwitchId; // 虚拟交换机id，对应表hmd_virtual_switch的id字段
    @Column("name")
    private String name; // 名称

    private HmdServerVirtualSwitch virtualSwitch; // 使用的虚拟交换机
    private HmdServer server; // 所属服务器

    public Long getServerId() {
        return serverId;
    }

    public void setServerId(Long serverId) {
        this.serverId = serverId;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public Integer getVlanId() {
        return vlanId;
    }

    public void setVlanId(Integer vlanId) {
        this.vlanId = vlanId;
    }

    public Long getVirtualSwitchId() {
        return virtualSwitchId;
    }

    public void setVirtualSwitchId(Long virtualSwitchId) {
        this.virtualSwitchId = virtualSwitchId;
    }

    public String getName() {
        return name;
    }

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

    public HmdServerVirtualSwitch newVirtualSwitch() {
        this.virtualSwitch = new HmdServerVirtualSwitch();
        return virtualSwitch;
    }

    public HmdServerVirtualSwitch getVirtualSwitch() {
        return virtualSwitch;
    }

    public void setVirtualSwitch(HmdServerVirtualSwitch virtualSwitch) {
        this.virtualSwitch = virtualSwitch;
    }

    public HmdServer getServer() {
        return server;
    }

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

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        HmdServerVirtualNetwork that = (HmdServerVirtualNetwork) o;
        return Objects.equals(uuid, that.uuid);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uuid);
    }
}

