
package dev.sonpx.loyalty.mcp.enums;

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

/**
 * Created by SonPhung on Monday, 20-Jul-2026
 */
@Getter
@RequiredArgsConstructor
public enum AttributeEntityType {
    CLIENT("CLIENT"),
    PRODUCT_ACCOUNT("PRODUCT_ACCOUNT"),
    CARD("CARD"),
    CORPORATION("CORPORATION"),
    CHAIN("CHAIN"),
    STORE("STORE"),
    //    TRANSACTIONS("TRANSACTIONS"),
    CAMPAIGN("CAMPAIGN"),
    ITEM("ITEM");

    @JsonValue
    private final String code;

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