package com.jeesharp.business.modules.finance.merchantreceivable.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 平台佣金周期汇总粒度枚举。
 *
 * @author jeesharp
 * @since 2026-06-29
 */
@Getter
@AllArgsConstructor
public enum MerchantReceivableSummaryGroupByEnum {

  /**
   * 按自然日
   */
  DAY("DAY", "按日"),

  /**
   * 按自然月
   */
  MONTH("MONTH", "按月");

  private final String value;

  private final String desc;

  public static MerchantReceivableSummaryGroupByEnum fromValue(String value) {
    if (value == null || value.isBlank()) {
      return DAY;
    }
    for (MerchantReceivableSummaryGroupByEnum item : values()) {
      if (item.getValue().equalsIgnoreCase(value.trim())) {
        return item;
      }
    }
    return DAY;
  }
}
