package com.yiqi.common.enums;

/**
 * @Author BKGin
 * @Email libra14xu@gmail.com
 * @Date 2024-09-07
 */
public enum OrderDeliveryStatusEnum {

    WAIT_DELIVERY("0", "待派单"),
    CREATE_ORDER_SUCCESS("1", "已派单"),
    RECEIVE_ORDER("2", "已接单"),
    HAS_TO_DOOR("3", "已上门"),
    SENDING("4", "配送中"),
    SEND_FINISH("9", "配送完成"),

    STORE_CANCEL("100", "商家取消配送订单"),
    DELIVERY_CANCEL("101", "配送方取消订单"),
    SENDER_CANCEL("102", "配送员撤单"),
    ;

    private final String code;
    private final String label;

    OrderDeliveryStatusEnum(String code, String label) {
        this.code = code;
        this.label = label;
    }

    public String getCode() {
        return code;
    }

    public String getLabel() {
        return label;
    }

    public static String getLabelByCode(String code) {
        for (OrderDeliveryStatusEnum item : OrderDeliveryStatusEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getLabel();
            }
        }
        return "";
    }

}
