package com.kamco.cd.kamcoback.common.enums;

import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
import java.util.Arrays;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Common usage status used across the system.
 *
 * <p>This enum represents whether a resource is active, excluded from processing, or inactive. It
 * is commonly used for filtering, business rules, and status management.
 */
@Getter
@AllArgsConstructor
public enum CommonUseStatus implements EnumType {

  // @formatter:off
  USE("USE", "Active", 100)
  /** Actively used and available */
  ,
  EXCEPT("EXCEPT", "Excluded", 200)
  /** Explicitly excluded from use or processing */
  ,
  NOT_USE("NOT_USE", "Inactive", 999)
/** Not used or disabled */
;
  // @formatter:on

  private String id;
  private String text;
  private int ordering;

  public static CommonUseStatus getEnumById(String id) {
    return Arrays.stream(CommonUseStatus.values())
        .filter(x -> x.getId().equals(id))
        .findFirst()
        .orElse(CommonUseStatus.NOT_USE);
  }
}
