package com.yiqi.common.enums;

import com.wechat.pay.java.service.refund.model.Status;

public enum OrderRefundStatus {

    OK("0", "正常"),
    REFUND_APPLYING("1", "退款申请中"),
    REFUNDING("2", "退款中"),
    REFUND_SUCCESS("3", "退款成功"),
    REFUND_CANCEL("-1", "退款取消"),
    REFUND_REFUSE("-2", "退款驳回"),
    ERROR("-3", "退款失败"),
    ;

    private final String code;
    private final String info;

    OrderRefundStatus(String code, String info)
    {
        this.code = code;
        this.info = info;
    }

    public String getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }

    public static String wxStatusTransfer(Status status){
        switch (status){
            case SUCCESS:
                return OrderRefundStatus.OK.getCode();
            case CLOSED:
                return OrderRefundStatus.REFUND_CANCEL.getCode();
            case PROCESSING:
                return OrderRefundStatus.REFUNDING.getCode();
            case ABNORMAL:
                return OrderRefundStatus.ERROR.getCode();
        }
        return OrderRefundStatus.ERROR.getCode();
    }
}
