package com.fs.erp.dto.sdk.df.enums;

import java.util.Objects;

public enum RequestUrlEnum {
    CREAT_ORDER("order/create", "POST"),
    ORDER_RESULT("query/order", "POST"),
    ORDER_DELIVERY("query/route", "GET"),
    ORDER_DELIVERY_STATUS("query/waybill", "POST"),
    ORDER_CANCEL("order/cancel", "POST");

    private final String url;
    private final String type;

    RequestUrlEnum(String url, String type) {
        this.url = url;
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public String getType() {
        return type;
    }

    /**
     * 根据类型值获取枚举实例
     * @param url 类型值
     * @return 对应的枚举实例, 如果找不到则返回 null
     */
     public static RequestUrlEnum fromValue(String url){
         for(RequestUrlEnum requestUrl : RequestUrlEnum.values()){
             if(Objects.equals(requestUrl.url, url)){
                 return  requestUrl;
             }
         }
         return null;
     }
}
