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 HourOrRateTypeEnum {

    LaborHour("LaborHour", "人员工时"),
    LaborHourRate("LaborHourRate", "人员小时费率"),
    MaterialUnitPrice("MaterialUnitPrice", "物料采购单价"),
    EquipmentHour("EquipmentHour", "设备工时"),
    EquipmentHourRate("EquipmentHourRate", "设备小时费率"),
    SupplyMaterialHour("SupplyMaterialHour", "辅料工时"),
    SupplyMaterialHourRate("SupplyMaterialHourRate", "辅料小时费率"),
    DriverHour("DriverHour", "燃动工时"),
    DriverHourRate("DriverHourRate", "燃动小时费率"),
    OtherHour("OtherHour", "其他工时"),
    OtherHourRate("OtherHourRate", "其他小时费率");

    private final String code;
    private final String name;

    HourOrRateTypeEnum(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 (HourOrRateTypeEnum value : HourOrRateTypeEnum.values()) {
            if (value.getCode().equals(codeNo)) {
                return value.name();
            }
        }
        return codeNo.toString();
    }

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