package com.zzsmart.qomo.kn.cost.manage.enums;

/**
 * @Classname StandardStageEnum
 * @Description 阶段枚举
 * @Version 1.0.0
 * @Date 2024/6/18 9:51
 * @Created wangqiong
 */
public enum TotalCostEnum {


    TotalLaborCost("TotalLaborCost", "总人工成本"), TotalMaterialCost("TotalMaterialCost", "总物料成本"), TotalEquipmentFee("TotalEquipmentFee", "总设备费"), TotalSupplyMaterialFee("TotalSupplyMaterialFee", "总辅料费"), TotalDriverFee("TotalDriverFee", "总水电费"), TotalOtherFee("TotalOtherFee", "总其他费用"), TotalLogisticsFee("TotalLogisticsFee", "总物流费"), TotalStandardCost("TotalStandardCost", "总标准成本");


    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据code获取text
     *
     * @param codeNo
     * @return
     */
    public static String getTextByCode(String codeNo) {
        for (TotalCostEnum value : TotalCostEnum.values()) {
            if (value.getCode().equals(codeNo)) {
                return value.name();
            }
        }
        return codeNo.toString();
    }

    /**
     * 根据text获取code
     *
     * @param name
     * @return
     */
    public static String getCodeByName(String name) {
        for (TotalCostEnum value : TotalCostEnum.values()) {
            if (value.name().equals(name)) {
                return value.name();
            }
        }
        return name;
    }
}
