package com.bocloud.ims.entity.resource;

import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 存储FlashCopy
 * @author luyanchao
 */
@Table("flash_copy")
public class FlashCopy extends GenericEntity {

    @PK(value = PKStrategy.AUTO)
    private Long id; //
    @Column("vendor_id")
    private Long vendorId; // 云供应商ID
    @Column("flash_copy_uuid")
    private String flashCopyUuid; // 标识
    @Column("source_volume_id")
    private Long sourceVolumeId; // 源卷id
    @Column("source_volume_name")
    @IgnoreAll
    private String sourceVolumeName; // 源卷名称
    @IgnoreAll
    private String sourcePoolName; // 源卷所属池名称
    @IgnoreAll
    private String sourceStorageName; // 源卷所属设备名称
    @Column("target_volume_id")
    private Long targetVolumeId; // 目标卷id
    @Column("target_volume_name")
    @IgnoreAll
    private String targetVolumeName; // 目标卷名称
    @IgnoreAll
    private String targetPoolName; // 目标卷所属池名称
    @IgnoreAll
    private String targetStorageName; // 目标卷所属设备名称
    @Column("progress")
    private Integer progress; // 进度
    @Column("group_id")
    private Long groupId; // 一致性组ID
    @Column("group_name")
    @IgnoreAll
    private String groupName; // 一致性名称
    @Column("start_time")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime; // 闪存时间
    @Column("copy_rate")
    private Integer copyRate; // 后台拷贝速率
    @Column("clean_rate")
    private Integer cleanRate; // 清除拷贝速率
    @Column("type")
    private String type; // 类型
    @Column("auto_delete")
    private Boolean autoDelete; // 拷贝完成后自动删除映射
    @Column("incremental")
    private Boolean incremental; // 递增
    @Column("key_path")
    private String keyPath; // smis传参用
    @IgnoreAll
    private Boolean start;// 是否自动启动
    @IgnoreAll
    private Long targetPoolId; // 目标池id，EMC创建FlashCopy不支持选择目标卷，目标卷是跟着FlashCopy创建出来的

    public String getKeyPath() {
        return keyPath;
    }

    public void setKeyPath(String keyPath) {
        this.keyPath = keyPath;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getSourceVolumeId() {
        return sourceVolumeId;
    }

    public void setSourceVolumeId(Long sourceVolumeId) {
        this.sourceVolumeId = sourceVolumeId;
    }

    public Long getTargetVolumeId() {
        return targetVolumeId;
    }

    public void setTargetVolumeId(Long targetVolumeId) {
        this.targetVolumeId = targetVolumeId;
    }

    public Integer getProgress() {
        return progress;
    }

    public void setProgress(Integer progress) {
        this.progress = progress;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Integer getCopyRate() {
        return copyRate;
    }

    public void setCopyRate(Integer copyRate) {
        this.copyRate = copyRate;
    }

    public Integer getCleanRate() {
        return cleanRate;
    }

    public void setCleanRate(Integer cleanRate) {
        this.cleanRate = cleanRate;
    }

    public String getType() {
        return type;
    }

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

    public String getSourceVolumeName() {
        return sourceVolumeName;
    }

    public void setSourceVolumeName(String sourceVolumeName) {
        this.sourceVolumeName = sourceVolumeName;
    }

    public String getTargetVolumeName() {
        return targetVolumeName;
    }

    public void setTargetVolumeName(String targetVolumeName) {
        this.targetVolumeName = targetVolumeName;
    }

    public Boolean getAutoDelete() {
        return autoDelete;
    }

    public void setAutoDelete(Boolean autoDelete) {
        this.autoDelete = autoDelete;
    }

    public Long getVendorId() {
        return vendorId;
    }

    public void setVendorId(Long vendorId) {
        this.vendorId = vendorId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public Boolean getIncremental() {
        return incremental;
    }

    public void setIncremental(Boolean incremental) {
        this.incremental = incremental;
    }

    public String getFlashCopyUuid() {
        return flashCopyUuid;
    }

    public void setFlashCopyUuid(String flashCopyUuid) {
        this.flashCopyUuid = flashCopyUuid;
    }

    public Boolean getStart() {
        return start;
    }

    public void setStart(Boolean start) {
        this.start = start;
    }

    public Long getTargetPoolId() {
        return targetPoolId;
    }

    public void setTargetPoolId(Long targetPoolId) {
        this.targetPoolId = targetPoolId;
    }

    public String getSourcePoolName() {
        return sourcePoolName;
    }

    public void setSourcePoolName(String sourcePoolName) {
        this.sourcePoolName = sourcePoolName;
    }

    public String getSourceStorageName() {
        return sourceStorageName;
    }

    public void setSourceStorageName(String sourceStorageName) {
        this.sourceStorageName = sourceStorageName;
    }

    public String getTargetPoolName() {
        return targetPoolName;
    }

    public void setTargetPoolName(String targetPoolName) {
        this.targetPoolName = targetPoolName;
    }

    public String getTargetStorageName() {
        return targetStorageName;
    }

    public void setTargetStorageName(String targetStorageName) {
        this.targetStorageName = targetStorageName;
    }
}
