
package dev.sonpx.loyalty.mcp.enums;

import java.util.Arrays;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum AttributeDataType {
    STRING("STRING"),
    NUMBER("NUMBER"),
    DATE("DATE"),
    BOOLEAN("BOOLEAN"),
    TIME("TIME");

    private final String code;

    public static AttributeDataType fromCode(String code) {
        return Arrays.stream(AttributeDataType.values())
                .filter(o -> code.equals(o.getCode()))
                .findFirst()
                .orElse(null);
    }
}
