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

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

import java.util.List;
import java.util.Objects;

@Table("hmd_virtual_fabric_adapter")
public class HmdVirtualFabricAdapter extends HmdGenericEntity {
    @Column("uuid")
    private String uuid; // 唯一标识
    @Column("name")
    private String name; // 名称
    @Column("target_id")
    private Long targetId; // 目标id，取值hmd_partition的id或hmd_profile的id
    @Column("target_type")
    private String targetType; // 目标类型，取值：partition或profile
    @Column("adapter_id")
    private Integer adapterId; // 适配器id
    @Column("remote_partition_id")
    private Long remotePartitionId; // 对端分区id，取值hmd_partition的id
    @Column("remote_adapter_id")
    private Integer remoteAdapterId; // 对端适配器id
    @Column("type")
    private String type; // 适配器类型：Client或Server
    @Column("is_required")
    private Boolean isRequired; // 要激活分区，此适配器时必须的
    @Column("is_varied")
    private Boolean isVaried; // 多彩多样的
    @Column("location_code")
    private String locationCode; // 物理位置码
    @Column("unique_device_id")
    private String uniqueDeviceID; // 唯一设备id

    private HmdPartition partition; // 所属的lpar/vios
    private HmdProfile profile; // 所属的概要文件
    private HmdPartition remotePartition; // 远端的lpar/vios

    private List<HmdVirtualFabricAdapterWwpn> wwpns; // wwpn列表

    public String getName() {
        return name;
    }

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

    public Long getTargetId() {
        return targetId;
    }

    public void setTargetId(Long targetId) {
        this.targetId = targetId;
    }

    public String getTargetType() {
        return targetType;
    }

    public void setTargetType(String targetType) {
        this.targetType = targetType;
    }

    public Integer getAdapterId() {
        return adapterId;
    }

    public void setAdapterId(Integer adapterId) {
        this.adapterId = adapterId;
    }

    public Long getRemotePartitionId() {
        return remotePartitionId;
    }

    public void setRemotePartitionId(Long remotePartitionId) {
        this.remotePartitionId = remotePartitionId;
    }

    public Integer getRemoteAdapterId() {
        return remoteAdapterId;
    }

    public void setRemoteAdapterId(Integer remoteAdapterId) {
        this.remoteAdapterId = remoteAdapterId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Boolean getIsRequired() {
        return isRequired;
    }

    public void setIsRequired(Boolean isRequired) {
        this.isRequired = isRequired;
    }

    public Boolean getIsVaried() {
        return isVaried;
    }

    public void setIsVaried(Boolean isVaried) {
        this.isVaried = isVaried;
    }

    public String getLocationCode() {
        return locationCode;
    }

    public void setLocationCode(String locationCode) {
        this.locationCode = locationCode;
    }

    public String getUuid() {
        return uuid;
    }

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

    public HmdPartition getRemotePartition() {
        return remotePartition;
    }

    public HmdPartition newRemotePartition() {
        this.remotePartition = new HmdPartition();
        return remotePartition;
    }

    public void setRemotePartition(HmdPartition remotePartition) {
        this.remotePartition = remotePartition;
    }

    public List<HmdVirtualFabricAdapterWwpn> getWwpns() {
        return wwpns;
    }

    public void setWwpns(List<HmdVirtualFabricAdapterWwpn> wwpns) {
        this.wwpns = wwpns;
    }

    public String getUniqueDeviceID() {
        return uniqueDeviceID;
    }

    public void setUniqueDeviceID(String uniqueDeviceID) {
        this.uniqueDeviceID = uniqueDeviceID;
    }

    public HmdPartition getPartition() {
        return partition;
    }

    public void setPartition(HmdPartition partition) {
        this.partition = partition;
    }

    public HmdProfile getProfile() {
        return profile;
    }

    public void setProfile(HmdProfile profile) {
        this.profile = profile;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        HmdVirtualFabricAdapter that = (HmdVirtualFabricAdapter) o;
        return Objects.equals(targetId, that.targetId) &&
                Objects.equals(targetType, that.targetType) &&
                Objects.equals(adapterId, that.adapterId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(targetId, targetType, adapterId);
    }
}

