package com.younike.system.enums;

import com.younike.common.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 订单状态枚举类
 */
@AllArgsConstructor
@Getter
public enum OrderStateEnum {

    PENDING_PAYMENT("000", "待付款"),
    PENDING_SERVICE("001", "待服务"),
    IN_SERVICE("002", "服务中"),
    PENDING_CONFIRMED("003", "待确认"),
    FINISHED("004", "已完成"),
    PENDING_REFUNDED("005", "已申请退款"),
    REFUNDED("006", "已退款"),
    REJECTED("007", "已拒绝"),
    CANCELED("099", "已取消");


    private String code;

    private String desc;

    public static String getDescription(String code) {
        for (OrderStateEnum item : OrderStateEnum.values()) {
            if(item.getCode().equals(code)){
                return item.getDesc();
            }
        }
        return StringUtils.EMPTY;
    }
}
