package cn.pluss.platform.vo;

import cn.pluss.platform.entity.MercOrderExpress;
import cn.pluss.platform.entity.MercOrderExpressDetail;
import cn.pluss.platform.enums.LogisticProvider;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * TODO
 * 物流信息返回实体类封装
 * @author crystal
 * @date 2022/3/28 10:59
 */
@Data
@ApiModel("订单物流信息VO")
@EqualsAndHashCode(callSuper = true)
public class MercOrderExpressVO extends MercOrderExpress {

    /**
     * 物流详情
     */
    private List<MercOrderExpressDetail> expressDetailList;

    private String statusDesc;

    private String logisticProvider;

    /**
     * 服务热线
     */
    private String serviceTelephone;


    /**
     * 快递物流渠道
     */
    private String logisticProviderDesc;

    public String getStatusDesc() {
        switch (this.getStatus()){
            case "00":
                this.statusDesc = "待发货";
                break;
            case "01":
                this.statusDesc = "已接单";
                break;
            case "02":
                this.statusDesc = "已揽收";
                break;
            case "03":
                this.statusDesc = "已收入";
                break;
            case "05":
                this.statusDesc = "已打包";
                break;
            case "06":
                this.statusDesc = "派件中";
                break;
            case "07":
                this.statusDesc = "自提柜入库";
                break;
            case "08":
                this.statusDesc = "已签收";
                break;
            case "90":
                this.statusDesc = "揽收失败";
                break;
            case "99":
                this.statusDesc = "签收失败";
                break;
            default:
                this.statusDesc = "未知";
                break;
        }
        return statusDesc;
    }

    public String getLogisticProviderDesc() {
        if (getLogisticProvider() == null) {
            return "";
        }

        LogisticProvider values = LogisticProvider.valueOf(this.getLogisticProvider());
        return values.getDesc();
    }
}
