package cn.pluss.platform.vo;

import cn.pluss.platform.entity.DeviceOperateInfo;
import cn.pluss.platform.enums.DeviceOperateType;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * TODO
 * 设备流转状态VO封装
 * @author crystal
 * @date 2022/4/2 16:35
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class DeviceOperateInfoVO extends DeviceOperateInfo {

    private String userName;

    private String merchantName;

    private String phone;

    private String desc;

    private String typeDesc;

    public String getTypeDesc() {
        return DeviceOperateType.getNameByCode(this.getType());
    }

    public String getDesc() {
        String type = this.getType();
        if(DeviceOperateType.IN.getCode().equals(type)){
            this.desc = "收银呗设备入库";
        }
        if(DeviceOperateType.TRANSFER.getCode().equals(type)){
            this.desc = this.getRemark();
        }
        if(DeviceOperateType.RECEIVE.getCode().equals(type)){
            this.desc = this.getUserName() + "(<span style='color:#1296DB'>"+this.getPhone()+"</span>)已接收";
        }
        if(DeviceOperateType.BIND.getCode().equals(type)){
            this.desc = this.getUserName()+"绑定此设备至" + "【"+this.getMerchantName()+"】店铺";
        }
        if(DeviceOperateType.UNBIND.getCode().equals(type)){
            this.desc = this.getUserName()+"从" + "【"+this.getMerchantName()+"】店铺解绑";
        }
        if(DeviceOperateType.BUY.getCode().equals(type)){
            this.desc = this.getUserName()+"(<span style='color:#1296DB'>"+this.getPhone()+"</span>)" + "从设备商城中购买此设备";
        }
        return "<span style='color:#E79731'>" + getTypeDesc() + ": " + "</span>" + this.desc;
    }

}
