package com.xinelu.common.enums;

import com.xinelu.common.exception.ServiceException;
import lombok.Getter;

/**
 * @Author mengkuiliang
 * @Description 家医配置枚举 对应 application.yml中的 fd模块的配置
 * @Date 2023-09-21 021 17:31
 * @Param
 * @return
 **/
@Getter
public enum RegionKeyType {
    /**
     * 德州 ${fd.dz}
     */
    DZ("1", "dz"),
    /**
     * 东营 ${fd.dy}
     */
    DY("2", "dy");

    private final String code;
    private final String name;

    RegionKeyType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static RegionKeyType getRegionKeyByCode(String code) {
        for (RegionKeyType uploadType : RegionKeyType.values()) {
            if (uploadType.getCode().equals(code)) {
                return uploadType;
            }
        }
        throw new ServiceException("未查询到区域配置");
    }
}
