package com.bocloud.cmp.model.installation;

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.ObjectUtils;

/**
 * 从RackHD的catalog的driveid获取到的硬盘信息
 *
 * @author 007
 */
public class DriveId implements Comparable<DriveId> {
    /**
     * scsiId
     * <p>
     * "0:2:0:0"
     */
    private String scsiId;
    /**
     * virtualDisk
     * <p>
     * "/c0/v0"
     */
    private String virtualDisk;
    /**
     * esxiWwid
     * <p>
     * "naa.61866da04d41750022030e4908426eb6"
     */
    private String esxiWwid;
    /**
     * devName
     * <p>
     * "sda"
     */
    private String devName;
    /**
     * identifier
     * <p>
     * 0
     */
    private Integer identifier;
    /**
     * linuxWwid
     * <p>
     * "/dev/disk/by-id/scsi-361866da04d41750022030e4908426eb6"
     */
    private String linuxWwid;
    /**
     * wwnWwid
     * <p>
     * "/dev/disk/by-id/wwn-361866da04d41750022030e4908426eb6"
     */
    private String wwnWwid;

    /**
     * @return the scsiId
     */
    public String getScsiId() {
        return scsiId;
    }

    /**
     * @param scsiId the scsiId to set
     */
    public void setScsiId(String scsiId) {
        this.scsiId = scsiId;
    }

    /**
     * @return the virtualDisk
     */
    public String getVirtualDisk() {
        return virtualDisk;
    }

    /**
     * @param virtualDisk the virtualDisk to set
     */
    public void setVirtualDisk(String virtualDisk) {
        this.virtualDisk = virtualDisk;
    }

    /**
     * @return the esxiWwid
     */
    public String getEsxiWwid() {
        return esxiWwid;
    }

    /**
     * @param esxiWwid the esxiWwid to set
     */
    public void setEsxiWwid(String esxiWwid) {
        this.esxiWwid = esxiWwid;
    }

    /**
     * @return the devName
     */
    public String getDevName() {
        return devName;
    }

    /**
     * @param devName the devName to set
     */
    public void setDevName(String devName) {
        this.devName = devName;
    }

    /**
     * @return the identifier
     */
    public Integer getIdentifier() {
        return identifier;
    }

    /**
     * @param identifier the identifier to set
     */
    public void setIdentifier(Integer identifier) {
        this.identifier = identifier;
    }

    /**
     * @return the linuxWwid
     */
    public String getLinuxWwid() {
        return linuxWwid;
    }

    /**
     * @param linuxWwid the linuxWwid to set
     */
    public void setLinuxWwid(String linuxWwid) {
        this.linuxWwid = linuxWwid;
    }

    public DriveId() {
        super();
    }

    public String getWwnWwid() {
        return wwnWwid;
    }

    public void setWwnWwid(String wwnWwid) {
        this.wwnWwid = wwnWwid;
    }

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }

    @Override
    public int compareTo(DriveId driveId) {
        return ObjectUtils.compare(this.getDevName(), driveId.getDevName()) * 100 +
                ObjectUtils.compare(this.getVirtualDisk(), driveId.getVirtualDisk()) * 10 +
                ObjectUtils.compare(this.getIdentifier(), driveId.getIdentifier());
    }
}
