package com.jwipc.tender.constant;

import lombok.Getter;

import java.math.BigDecimal;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Getter
public enum DimensionCode {
    DC_PRICE("dc_price", "价格分", BigDecimal.valueOf(0.4)),
    DC_TOUCH("dc_touch", "技术分", BigDecimal.valueOf(0.3)),
    DC_BUSINESS("dc_business", "商务分", BigDecimal.valueOf(0.3)),
    DC_TOTAL("dc_total", "总分", BigDecimal.valueOf(1));
    private final String code;
    private final String name;
    private final BigDecimal weight;

    DimensionCode(String code, String name, BigDecimal weight) {
        this.code = code;
        this.name = name;
        this.weight = weight;
    }

    public static DimensionCode getByCode(String code) {
        for (DimensionCode dimensionCode : DimensionCode.values()) {
            if (dimensionCode.getCode().equals(code)) {
                return dimensionCode;
            }
        }
        return null;
    }
}

