package com.slodon.b2b2c.vo.integral;

import com.slodon.b2b2c.core.constant.OrderConst;
import com.slodon.b2b2c.core.i18n.Language;
import com.slodon.b2b2c.integral.pojo.IntegralOrder;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 封装校验是否能生成电子面单订单VO对象
 */
@Data
public class FaceSheetCheckOrderVO implements Serializable {

    private static final long serialVersionUID = -2033109936836784777L;
    @ApiModelProperty("订单号")
    private String orderSn;

    @ApiModelProperty("受限")
    private String restrict;

    @ApiModelProperty("受限原因")
    private String restrictReason;

    public FaceSheetCheckOrderVO(IntegralOrder integralOrder) {
        this.orderSn = integralOrder.getOrderSn();
        if (OrderConst.ORDER_STATE_20 != integralOrder.getOrderState()) {
            //翻译
            this.restrictReason = Language.translate("订单不支持电子面单发货");
            this.restrict = Language.translate("无法生成电子面单");
        } else if (OrderConst.IS_GENERATE_FACE__SHEET_1 == integralOrder.getIsGenerateFacesheet()) {
            //翻译
            this.restrictReason = Language.translate("当前已生成电子面单");
            this.restrict = Language.translate("无法生成电子面单");
        } else {
            //翻译
            this.restrictReason = Language.translate("点击继续操作");
            this.restrict = Language.translate("无");
        }
    }

}
