package com.cool.store.enums;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public enum ApiErrorCodeEnum {
    LINE_INFO("lineInfoDO","线索信息缺失"),
    FRANCHISE_FEE("franchiseFeeDO","缴费信息缺失"),
    SIGNING_BASE_INFO("signingBaseInfoDO","签约信息缺失"),
    LINE_PAY("linePayDO","缴款信息缺失"),
    POINT_INFO("pointInfoDO","铺位信息缺失"),
    SYSTEM_BUILDING_SHOP("systemBuildingShopDO","建店数据缺失"),
    LICENSE_TRANSACT("licenseTransactDO","证照办理数据缺失"),
    THIRD_DEPARTMENT("thirdDepartmentDO","三方部门表缺失"),
    ;


    private String errorMessage;
    private String code;

    ApiErrorCodeEnum(String code, String errorMessage) {
        this.code = code;
        this.errorMessage = errorMessage;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public String getCode() {
        return code;
    }
    protected static final Map<String, ApiErrorCodeEnum> map = Arrays.stream(values()).collect(
            Collectors.toMap(ApiErrorCodeEnum::getCode, Function.identity(), (a, b)->a));

    public static ApiErrorCodeEnum getByCode(String code) {
        return map.get(code);
    }
}
