package com.ylx.massage.enums;

import com.ylx.common.utils.StringUtils;
import lombok.Getter;
import org.apache.commons.compress.utils.Lists;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jianlong
 * @date 2024-03-27 11:51
 * 订单状态枚举
 */
@Getter
public enum OrderStatusEnumVo {

    ALL(100, "全部",""),

    //进行中(待接单,已接单,已到达,服务中 0123)
    SERVICE(10, "进行中","    WAIT_JD(0, \"待接单\"),\n" +
            "    RECEIVED_ORDER(1, \"已接单\"),\n" +
            "    ARRIVED(2, \"已到达\"),\n" +
            "    SERVICE(3, \"服务中\"),"),
    WAIT_EVALUATE(4, "待评价",""),
    COMPLETE(5, "已完成",""),
    WAIT_PAY(-1, "待付款",""),
    CANCEL(-10, "已取消","已取消-2,已拒绝-3");


    private final Integer code;
    private final String info;
    private final String desc;

    OrderStatusEnumVo(Integer code, String info, String desc) {
        this.code = code;
        this.info = info;
        this.desc = desc;
    }

    /**
     * 获取订单状态枚举
     * @return List<Enumproject>
     */
    public static List<Enumproject> getStatusEnum() {
        ArrayList<Enumproject> objects = Lists.newArrayList();
        for (OrderStatusEnumVo value : OrderStatusEnumVo.values()) {
            Enumproject enumproject = new Enumproject();
            enumproject.setInfo(value.getInfo());
            enumproject.setCode(value.getCode());
            objects.add(enumproject);

        }
        return objects;
    }

    public static String getDescByCode(Integer code) {
        for (OrderStatusEnumVo value : OrderStatusEnumVo.values()) {
            if(value.getCode().equals(code)){
                return value.getInfo();
            }
        }
        return StringUtils.EMPTY;
    }

}
