
package dev.sonpx.loyalty.mcp.reward.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Arrays;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * Created by SonPhung on Monday, 20-Jul-2026
 */
@Getter
@RequiredArgsConstructor
public enum AmountToUseViewType {
    CODE(null, null),
    ATTRIBUTE("A", "Attribute"),
    COUNTER("C", "Counter");

    private final String code;
    private final String name;

    @JsonCreator
    public static AmountToUseViewType fromCode(String code) {
        return Arrays.stream(values())
                .filter(e -> e.code.equalsIgnoreCase(code))
                .findFirst()
                .orElse(null);
    }
}
