package com.bonus.canteen.core.drp.utils;


import com.bonus.canteen.core.drp.constant.DrpInventoryStatusEnum;

import java.math.BigDecimal;

public class InventoryUtil {
   public static Integer getInventoryStatusByNum(BigDecimal maxNum, BigDecimal minNum, BigDecimal materialNum) {
      if (maxNum.compareTo(new BigDecimal(-1)) == 0) {
         return materialNum.compareTo(minNum) > 0 ? DrpInventoryStatusEnum.NORMAL.key() : DrpInventoryStatusEnum.INSUFFICIENT.key();
      } else if (materialNum.compareTo(maxNum) > 0) {
         return DrpInventoryStatusEnum.EXCESS.key();
      } else {
         return materialNum.compareTo(minNum) <= 0 ? DrpInventoryStatusEnum.INSUFFICIENT.key() : DrpInventoryStatusEnum.NORMAL.key();
      }
   }
}
