package com.slodon.b2b2c.vo.integral;

import com.slodon.b2b2c.core.i18n.Language;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 订单确认、订单提交前检测购物车状态VO
 */
@Data
public class IntegralOrderSubmitCheckVO {

    @ApiModelProperty("检测状态，0==检测通过，1==商品已下架，2==库存不足，3==商品已失效，4==活动失效，5==商品价格发生变化")
    private Integer state = STATE_0;
    @ApiModelProperty("检测状态值，0==检测通过，1==商品已下架，2==库存不足，3==商品已失效，4==活动失效，5==商品价格发生变化")
    private String stateValue;

    public String getStateValue() {
        String value = "检测通过";
        switch (getState()) {
            case STATE_1:
                value = "预购买商品已下架";
                break;
            case STATE_2:
                value = "预购买商品库存不足";
                break;
            case STATE_3:
                value = "预购买商品已失效";
                break;
            case STATE_4:
                value = "积分转换金额失败，请联系系统管理员！";
                break;
            case STATE_5:
                value = "商品价格发生变化";
                break;
            default:
                break;
        }
        //翻译
        value = Language.translate(value);
        return value;
    }

    /**
     * 检测状态常量
     */
    public static final int STATE_0 = 0;
    public static final int STATE_1 = 1;
    public static final int STATE_2 = 2;
    public static final int STATE_3 = 3;
    public static final int STATE_4 = 4;
    public static final int STATE_5 = 5;
}
