package com.red.circle.wallet.inner.model.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 货运账单余额来源.
 *
 * @author pengliang on 2021/7/7
 */
public enum FreightBalanceOrigin {

  /**
   * 出货.
   */
  SHIPMENT("出货"),

  /**
   * 进货.
   */
  PURCHASE("进货"),

  /**
   * 扣除.
   */
  DEDUCTION("扣除");

  private final String desc;

  FreightBalanceOrigin(String desc) {
    this.desc = desc;
  }

  public static String getDesc(String name) {
    return Stream.of(FreightBalanceOrigin.values())
        .filter(freightBalanceOrigin -> Objects
            .equals(freightBalanceOrigin.name(), name))
        .findFirst()
        .map(FreightBalanceOrigin::getDesc)
        .orElse("位置");
  }

  public String getDesc() {
    return desc;
  }
}
