package com.winsun.constant;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 配送方式
 * @author chenhaojian
 * @datetime 2021-07-28 11:11
 */
public enum DeliveryType {

    SELFMENTION("0","送货上门"), // 自提
    PROVINCIALCOMPANY("1","省仓配送"), // 省仓配送
    BTANCHOFFICE("2","本地配送"); // 分公司配送

    DeliveryType(String id, String name) {
        this.id = id;
        this.name = name;
    };

    private static final Map<String, DeliveryType> DATAS = new HashMap<>();
    static {
        Arrays.asList(values()).forEach(data -> DATAS.put(data.getId(), data));
    }

    private String id;

    private String name;

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static DeliveryType findById(String id) {
        return DATAS.getOrDefault(id, null);
    }
}
