package com.zm.order.tool.server.enums;

/**
 * @description:
 * @author: LiYong
 * @create: 2021/3/15 20:07
 */
public enum DeliveryPlatformEnum {
    /**
     * 商家自配
     */
    SELF(0, "商家配送"),

    /**
     * 美团
     */
    MEITUAN(1, "美团"),

    /**
     * 蜂鸟
     */
    FENGNIAO(2, "蜂鸟"),
    /**
     * 顺丰
     */
    SHUNFENG(3, "顺丰"),
    /**
     * 达达
     */
    DADA(4, "达达"),

    /**
     * UU跑腿
     */
    UU(6,"UU跑腿"),
    /**
     * dianwoda
     */
    DIANWODA(7,"dianwoda"),
    /**
     * candao
     */
    CANDAO(8,"candao"),

    FLASHSEND(9,"闪送"),

//    FASTSERVER(8,"快服务"),

    /**
     * 聚合接单三方平台配送
     */
    DIST_PLATFORM(20,"三方平台"),

    EXPRESS(5,"快递")
    ;

    private Integer code;
    private String name;

    DeliveryPlatformEnum(Integer id, String name) {
        this.code = id;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static DeliveryPlatformEnum findByCode(Integer code) {
        for (DeliveryPlatformEnum value : DeliveryPlatformEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }

        return null;
    }

    public static DeliveryPlatformEnum findByName(String name) {
        for (DeliveryPlatformEnum value : DeliveryPlatformEnum.values()) {
            if (value.getName().equals(name)) {
                return value;
            }
        }

        return null;
    }
}
