package com.dayou.report.enums;

import cn.hutool.core.util.StrUtil;
import com.dayou.report.calculation.cityPrice.bo.BusinessCenterBaseBO;
import com.dayou.report.calculation.cityPrice.bo.BusinessCenterIndexWeightBO;

import java.util.Arrays;

/**
 * 类说明：
 *
 * @author: wucl
 * @since: 2023/9/19
 * created with IntelliJ IDEA.
 */
public enum TableNoEnum {

    BUSINESS_CENTER_BASE("5-4-1", BusinessCenterBaseBO.class.getName(),"{{5-4-1}}"),
    BUSINESS_CENTER_INDEX_WEIGHT("5-4-2", BusinessCenterIndexWeightBO.class.getName(),"{{5-4-2}}"),
    BUSINESS_CENTER_FORMAT("5-4-3",null,"{{5-4-3}}"),
    BUSINESS_CENTER_LEVEL("5-4-4",null,"{{5-4-4}}"),
    BUSINESS_CENTER_SCALE("5-4-5",null,"{{5-4-5}}"),
    BUSINESS_CENTER_CAPACITY_SCORE("5-4-6",null,"{{5-4-6}}"),
    BUSINESS_CENTER_EFFECT_DISTANCE("5-4-7",null,"{{5-4-7}}"),
    BUSINESS_CENTER_EFFECT_SCORE("5-4-8",null,"{{5-4-8}}")
    ;

    TableNoEnum(String tableNo, String boClassName,String placeHolder) {
        this.tableNo = tableNo;
        this.boClassName = boClassName;
        this.placeHolder = placeHolder;
    }

    private String tableNo;

    private String boClassName;

    private String placeHolder;

    public String getTableNo() {
        return tableNo;
    }

    public String getBoClassName() {
        return boClassName;
    }

    public String getPlaceHolder() {
        return placeHolder;
    }

    public static String getClassByTableNo(String tableNo){
        try {
           return Arrays.stream(TableNoEnum.values()).filter(t -> StrUtil.equals(t.getTableNo(), tableNo)).findFirst()
                    .orElse(null).getBoClassName();
        } catch (NullPointerException e) {
            return null;
        }
    }

}
